21 #include <glib-object.h> 25 Type Type::fromInstance(
void *instance)
30 return G_TYPE_FROM_INSTANCE(instance);
34 Type Type::fromName(
const char *name)
36 return g_type_from_name(name);
39 QString Type::name()
const 41 return QString::fromUtf8(g_type_name(m_type));
44 Quark Type::nameQuark()
const 46 return g_type_qname(m_type);
49 bool Type::isValid()
const 51 return m_type != Type::Invalid;
54 bool Type::isAbstract()
const 56 return G_TYPE_IS_ABSTRACT(m_type);
59 bool Type::isDerived()
const 61 return G_TYPE_IS_DERIVED(m_type);
64 bool Type::isFundamental()
const 66 return G_TYPE_IS_FUNDAMENTAL(m_type);
69 bool Type::isValueType()
const 71 return G_TYPE_IS_VALUE_TYPE(m_type);
74 bool Type::hasValueTable()
const 76 return G_TYPE_HAS_VALUE_TABLE(m_type);
79 bool Type::isClassed()
const 81 return G_TYPE_IS_CLASSED(m_type);
84 bool Type::isInstantiatable()
const 86 return G_TYPE_IS_INSTANTIATABLE(m_type);
89 bool Type::isDerivable()
const 91 return G_TYPE_IS_DERIVABLE(m_type);
94 bool Type::isDeepDerivable()
const 96 return G_TYPE_IS_DEEP_DERIVABLE(m_type);
99 bool Type::isInterface()
const 101 return G_TYPE_IS_INTERFACE(m_type);
104 Type Type::fundamental()
const 106 return G_TYPE_FUNDAMENTAL(m_type);
109 Type Type::parent()
const 111 return g_type_parent(m_type);
114 uint Type::depth()
const 116 return g_type_depth(m_type);
119 Type Type::nextBase(Type rootType)
const 121 return g_type_next_base(m_type, rootType);
124 bool Type::isA(Type is_a_type)
const 126 return g_type_is_a(m_type, is_a_type);
129 static inline QList<Type> gtypeArrayToList(GType *array, uint n)
132 for(uint i = 0; i<n; ++i) {
133 result.append(array[i]);
139 QList<Type> Type::children()
const 142 GType *a = g_type_children(m_type, &n);
143 return gtypeArrayToList(a, n);
146 QList<Type> Type::interfaces()
const 149 GType *a = g_type_interfaces(m_type, &n);
150 return gtypeArrayToList(a, n);
153 QList<Type> Type::interfacePrerequisites()
const 156 GType *a = g_type_interface_prerequisites(m_type, &n);
157 return gtypeArrayToList(a, n);
160 void *Type::quarkData(
const Quark & qname)
const 162 return g_type_get_qdata(m_type, qname);
165 void Type::setQuarkData(
const Quark & qname,
void *data)
167 g_type_set_qdata(m_type, qname, data);
Wrappers for Glib and GObject classes.