Skip to content

Instantly share code, notes, and snippets.

@rainbyte
Created June 20, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rainbyte/da0d00f81d83eceb913d71d0e3681b2f to your computer and use it in GitHub Desktop.
Save rainbyte/da0d00f81d83eceb913d71d0e3681b2f to your computer and use it in GitHub Desktop.
[CCode (cheader_filename = "qmlbind.h")]
namespace Qml {
[CCode (has_target = true)]
public delegate void Func();
[CCode (cname = "struct qmlbind_application",
cprefix = "qmlbind_application_",
free_function = "qmlbind_application_release",
has_type_id = false)]
[Compact]
public class Application {
[CCode (cname = "qmlbind_application_new")]
public Application([CCode (array_length_pos = 0.9)] string[] argv);
public static unowned Application instance();
public int exec();
public static void process_events();
public static void next_tick(Func callback);
}
[CCode (cname = "struct qmlbind_engine",
cprefix = "qmlbind_engine_",
free_function = "qmlbind_engine_release",
has_type_id = false)]
[Compact]
public class Engine {
[CCode (cname = "qmlbind_engine_new")]
public Engine();
public Value eval(string str, string file,
int line_number);
public Value get_global_object();
public Value new_object();
public Value new_array(int length);
// public Value new_wrapper(MetaObject metaobj, qmlbind_backref ref);
public void add_import_path(string path);
public void collect_garbage();
}
[CCode (cname = "struct qmlbind_component",
cprefix = "qmlbind_component_",
free_function = "qmlbind_component_release",
has_type_id = false)]
[Compact]
public class Component {
[CCode (cname = "qmlbind_component_new")]
public Component(Engine engine);
public void load_path(string path);
public void set_data(string data, string path);
// public string get_error_string();
public Value create();
}
[CCode (cname = "struct qmlbind_value",
cprefix = "qmlbind_value_",
free_function = "qmlbind_value_release",
has_type_id = false)]
[Compact]
public class Value {
[CCode (cname = "qmlbind_value_new_undefined")]
public Value();
[CCode (cname = "qmlbind_value_new_null")]
public Value.null();
public Value clone();
public bool is_equal(Value value2);
public bool is_identical(Value value2);
public bool is_undefined();
public bool is_null();
public bool is_boolean();
public bool is_number();
public bool is_string();
public bool is_object();
public bool is_array();
public bool is_function();
public bool is_error();
public bool is_wrapper();
/* boolean */
[CCode (cname = "qmlbind_value_new_boolean")]
public Value.boolean(bool x);
public bool get_boolean();
/* number */
[CCode (cname = "qmlbind_value_new_number")]
public Value.number(double x);
public double get_number();
/* string */
[CCode (cname = "qmlbind_value_new_string_cstr")]
public Value.string(string x);
public string get_string();
/* object */
public Value get_property(string key);
public void set_property(string key, Value value);
public bool delete_property(string key);
public bool has_property(string key);
public bool has_index(int index);
public bool has_own_property(string key);
public Value get_prototype();
public void set_prototype(Value proto);
/* array */
public unowned Value get_array_item(int index);
public void set_array_item(int index, Value property);
/* function */
public Value call([CCode (array_length_pos = 0.9)]
string[] argv);
public Value call_constructor([CCode (array_length_pos = 0.9)]
string[] argv);
public Value call_with_instance(Value instance,
[CCode (array_length_pos = 1.9)]
string[] argv);
/* wrapper */
// public Backref get_backref();
}
[CCode (cname = "struct qmlbind_metaclass",
cprefix = "qmlbind_metaclass_",
free_function = "qmlbind_metaclass_release",
has_type_id = false)]
[Compact]
public class Metaclass {
[CCode (cname = "qmlbind_metaclass_new")]
// public Metaclass(Backref classHandle, string className,
// Interface interface);
public int add_method(string name, int arity);
public int add_signal(string name, int arity,
string[] params);
public int add_property(string name, string notifier_signal);
public int register(string uri,
int version_major, int version_minor,
string qmlName);
}
[CCode (cname = "struct qmlbind_iterator",
cprefix = "qmlbind_iterator_",
free_function = "qmlbind_iterator_release",
has_type_id = false)]
[Compact]
public class Iterator {
[CCode (cname = "qmlbind_iterator_new")]
public Iterator(Value object);
// public string get_key();
public Value get_value();
public void next();
public bool has_next();
}
[CCode (cname = "struct qmlbind_plugin",
cprefix = "qmlbind_plugin_",
free_function = "qmlbind_plugin_release",
has_type_id = false)]
[Compact]
public class Plugin {
[CCode (cname = "qmlbind_plugin_new")]
public Plugin(string filename);
// public string get_error_string();
public Value get_instance(Engine engine);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment