18 #include "refpointer.h" 20 #include <glib-object.h> 26 Quark q = g_quark_from_static_string(
"QGlib__wrapper_constructor");
29 for(
Type t = instanceType; t.isValid(); t = t.parent()) {
30 void *funcPtr = t.quarkData(q);
32 cppClass = (
reinterpret_cast<RefCountedObject *(*)(
void*)
>(funcPtr))(instance);
33 Q_ASSERT_X(cppClass,
"QGlib::constructWrapper",
34 "Failed to wrap instance. This is a bug in the bindings library.");
39 Q_ASSERT_X(
false,
"QGlib::constructWrapper",
40 QString(QLatin1String(
"No wrapper constructor found for this type (") +
41 instanceType.name() + QLatin1String(
"). Did you forget to call init()?.")).toUtf8());
47 static void qdataDestroyNotify(
void *cppInstance)
56 Quark q = g_quark_from_static_string(
"QGlib__object_wrapper");
61 g_object_set_qdata_full(G_OBJECT(gobject), q, obj, &qdataDestroyNotify);
71 Quark q = g_quark_from_static_string(
"QGlib__paramspec_wrapper");
76 g_param_spec_set_qdata_full(G_PARAM_SPEC(param), q, obj, &qdataDestroyNotify);
91 g_object_set_qdata_full(G_OBJECT(gobject), q, obj, &qdataDestroyNotify);
static Quark fromString(const char *str)
Wrappers for Glib and GObject classes.
RefCountedObject * constructWrapper(Type instanceType, void *instance)
Base class for all the reference-counted object wrappers.
Wrapper class for GQuark.