Class: QML::Exporter

Inherits:
Object
  • Object
show all
Defined in:
ext/qml/exporter.c

Instance Method Summary collapse

Instance Method Details

#add_method(name, arity) ⇒ Object



50
51
52
53
54
# File 'ext/qml/exporter.c', line 50

static VALUE exporter_add_method(VALUE self, VALUE name, VALUE arity) {
    qmlbind_exporter exporter = rbqml_get_exporter(self);
    qmlbind_exporter_add_method(exporter, rb_id2name(SYM2ID(name)), NUM2INT(arity));
    return Qnil;
}

#add_property(name, notifier) ⇒ Object



70
71
72
73
74
# File 'ext/qml/exporter.c', line 70

static VALUE exporter_add_property(VALUE self, VALUE name, VALUE notifier) {
    qmlbind_exporter exporter = rbqml_get_exporter(self);
    qmlbind_exporter_add_property(exporter, rb_id2name(SYM2ID(name)), rb_id2name(SYM2ID(notifier)));
    return Qnil;
}

#add_signal(name, params) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'ext/qml/exporter.c', line 56

static VALUE exporter_add_signal(VALUE self, VALUE name, VALUE params) {
    qmlbind_exporter exporter = rbqml_get_exporter(self);

    int arity = RARRAY_LEN(params);

    const char **paramStrs = alloca(arity * sizeof(char *));
    for (int i = 0; i < arity; ++i) {
        paramStrs[i] =  rb_id2name(SYM2ID(RARRAY_AREF(params, i)));
    }

    qmlbind_exporter_add_signal(exporter, rb_id2name(SYM2ID(name)), arity, paramStrs);
    return Qnil;
}

#to_meta_objectObject



76
77
78
79
80
# File 'ext/qml/exporter.c', line 76

static VALUE exporter_to_metaobject(VALUE self) {
    qmlbind_exporter exporter = rbqml_get_exporter(self);
    qmlbind_metaobject metaobj = qmlbind_metaobject_new(exporter);
    return rbqml_metaobject_new(metaobj);
}