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