Type

struct Type {}

Members

Static functions

addClassCacheFunc
void addClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)

Adds a #GTypeClassCacheFunc to be called before the reference count of a class goes from one to zero. This can be used to prevent premature class destruction. All installed #GTypeClassCacheFunc functions will be chained until one of them returns %TRUE. The functions have to check the class id passed in to figure whether they actually want to cache the class of this type, since all classes are routed through the same #GTypeClassCacheFunc chain.

addClassPrivate
void addClassPrivate(GType classType, size_t privateSize)

Registers a private class structure for a classed type; when the class is allocated, the private structures for the class and all of its parent types are allocated sequentially in the same memory block as the public structures, and are zero-filled.

addInstancePrivate
int addInstancePrivate(GType classType, size_t privateSize)
addInterfaceCheck
void addInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)

Adds a function to be called after an interface vtable is initialized for any class (i.e. after the @interface_init member of #GInterfaceInfo has been called).

addInterfaceDynamic
void addInterfaceDynamic(GType instanceType, GType interfaceType, TypePluginIF plugin)

Adds the dynamic @interface_type to @instantiable_type. The information contained in the #GTypePlugin structure pointed to by @plugin is used to manage the relationship.

addInterfaceStatic
void addInterfaceStatic(GType instanceType, GType interfaceType, GInterfaceInfo* info)

Adds the static @interface_type to @instantiable_type. The information contained in the #GInterfaceInfo structure pointed to by @info is used to manage the relationship.

checkClassCast
TypeClass checkClassCast(TypeClass gClass, GType isAType)
checkClassIsA
bool checkClassIsA(TypeClass gClass, GType isAType)
checkInstance
bool checkInstance(TypeInstance instanc)

Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE() macro.

checkInstanceCast
TypeInstance checkInstanceCast(TypeInstance instanc, GType ifaceType)
checkInstanceIsA
bool checkInstanceIsA(TypeInstance instanc, GType ifaceType)
checkInstanceIsFundamentallyA
bool checkInstanceIsFundamentallyA(TypeInstance instanc, GType fundamentalType)
checkIsValueType
bool checkIsValueType(GType type)
checkValue
bool checkValue(Value value)
checkValueHolds
bool checkValueHolds(Value value, GType type)
children
GType[] children(GType type)

Return a newly allocated and 0-terminated array of type IDs, listing the child types of @type.

createInstance
TypeInstance createInstance(GType type)

Creates and initializes an instance of @type if @type is valid and can be instantiated. The type system only performs basic allocation and structure setups for instances: actual instance creation should happen through functions supplied by the type's fundamental type implementation. So use of g_type_create_instance() is reserved for implementators of fundamental types only. E.g. instances of the #GObject hierarchy should be created via g_object_new() and never directly through g_type_create_instance() which doesn't handle things like singleton objects or object construction.

defaultInterfacePeek
TypeInterface defaultInterfacePeek(GType gType)

If the interface type @g_type is currently in use, returns its default interface vtable.

defaultInterfaceRef
TypeInterface defaultInterfaceRef(GType gType)

Increments the reference count for the interface type @g_type, and returns the default interface vtable for the type.

defaultInterfaceUnref
void defaultInterfaceUnref(TypeInterface gIface)

Decrements the reference count for the type corresponding to the interface default vtable @g_iface. If the type is dynamic, then when no one is using the interface and all references have been released, the finalize function for the interface's default vtable (the @class_finalize member of #GTypeInfo) will be called.

depth
uint depth(GType type)

Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.

ensure
void ensure(GType type)

Ensures that the indicated @type has been registered with the type system, and its _class_init() method has been run.

freeInstance
void freeInstance(TypeInstance instanc)

Frees an instance of a type, returning it to the instance pool for the type, if there is one.

fromName
GType fromName(string name)

Lookup the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).

fundamental
GType fundamental(GType typeId)

Internal function, used to extract the fundamental type ID portion. Use G_TYPE_FUNDAMENTAL() instead.

fundamentalNext
GType fundamentalNext()

Returns the next free fundamental type id which can be used to register a new fundamental type with g_type_register_fundamental(). The returned type ID represents the highest currently registered fundamental type identifier.

getInstanceClass
T* getInstanceClass(ObjectG obj)
Undocumented in source. Be warned that the author may not have intended to support it.
getInstanceCount
int getInstanceCount(GType type)

Returns the number of instances allocated of the particular type; this is only available if GLib is built with debugging support and the instance_count debug flag is set (by setting the GOBJECT_DEBUG variable to include instance-count).

getPlugin
TypePluginIF getPlugin(GType type)

Returns the #GTypePlugin structure for @type.

getQdata
void* getQdata(GType type, GQuark quark)

Obtains data which has previously been attached to @type with g_type_set_qdata().

getTypeRegistrationSerial
uint getTypeRegistrationSerial()

Returns an opaque serial number that represents the state of the set of registered types. Any time a type is registered this serial changes, which means you can cache information based on type lookups (such as g_type_from_name()) and know if the cache is still valid at a later time by comparing the current serial with the one at the type lookup.

init
void init()

This function used to initialise the type system. Since GLib 2.36, the type system is initialised automatically and this function does nothing.

initWithDebugFlags
void initWithDebugFlags(GTypeDebugFlags debugFlags)

This function used to initialise the type system with debugging flags. Since GLib 2.36, the type system is initialised automatically and this function does nothing.

interfaces
GType[] interfaces(GType type)

Return a newly allocated and 0-terminated array of type IDs, listing the interface types that @type conforms to.

isA
bool isA(GType type, GType isAType)

If @is_a_type is a derivable type, check whether @type is a descendant of @is_a_type. If @is_a_type is an interface, check whether @type conforms to it.

name
string name(ObjectG obj)

Get the unique name that is assigned to the Objects type.

name
string name(GType type)

Get the unique name that is assigned to a type ID. Note that this function (like all other GType API) cannot cope with invalid type IDs. %G_TYPE_INVALID may be passed to this function, as may be any other validly registered type ID, but randomized type IDs should not be passed in and will most likely lead to a crash.

nameFromClass
string nameFromClass(TypeClass gClass)
nameFromInstance
string nameFromInstance(TypeInstance instanc)
nextBase
GType nextBase(GType leafType, GType rootType)

Given a @leaf_type and a @root_type which is contained in its anchestry, return the type that @root_type is the immediate parent of. In other words, this function determines the type that is derived directly from @root_type which is also a base class of @leaf_type. Given a root type and a leaf type, this function can be used to determine the types and order in which the leaf type is descended from the root type.

parent
GType parent(GType type)

Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.

qname
GQuark qname(GType type)

Get the corresponding quark of the type IDs name.

query
void query(GType type, GTypeQuery query)

Queries the type system for information about a specific type. This function will fill in a user-provided structure to hold type-specific information. If an invalid #GType is passed in, the @type member of the #GTypeQuery is 0. All members filled into the #GTypeQuery structure should be considered constant and have to be left untouched.

registerDynamic
GType registerDynamic(GType parentType, string typeName, TypePluginIF plugin, GTypeFlags flags)

Registers @type_name as the name of a new dynamic type derived from @parent_type. The type system uses the information contained in the #GTypePlugin structure pointed to by @plugin to manage the type and its instances (if not abstract). The value of @flags determines the nature (e.g. abstract or not) of the type.

registerFundamental
GType registerFundamental(GType typeId, string typeName, GTypeInfo* info, GTypeFundamentalInfo* finfo, GTypeFlags flags)

Registers @type_id as the predefined identifier and @type_name as the name of a fundamental type. If @type_id is already registered, or a type named @type_name is already registered, the behaviour is undefined. The type system uses the information contained in the #GTypeInfo structure pointed to by @info and the #GTypeFundamentalInfo structure pointed to by @finfo to manage the type and its instances. The value of @flags determines additional characteristics of the fundamental type.

registerStatic
GType registerStatic(GType parentType, string typeName, GTypeInfo* info, GTypeFlags flags)

Registers @type_name as the name of a new static type derived from @parent_type. The type system uses the information contained in the #GTypeInfo structure pointed to by @info to manage the type and its instances (if not abstract). The value of @flags determines the nature (e.g. abstract or not) of the type.

registerStaticSimple
GType registerStaticSimple(GType parentType, string typeName, uint classSize, GClassInitFunc classInit, uint instanceSize, GInstanceInitFunc instanceInit, GTypeFlags flags)

Registers @type_name as the name of a new static type derived from @parent_type. The value of @flags determines the nature (e.g. abstract or not) of the type. It works by filling a #GTypeInfo struct and calling g_type_register_static().

removeClassCacheFunc
void removeClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)

Removes a previously installed #GTypeClassCacheFunc. The cache maintained by @cache_func has to be empty when calling g_type_remove_class_cache_func() to avoid leaks.

removeInterfaceCheck
void removeInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)

Removes an interface check function added with g_type_add_interface_check().

setQdata
void setQdata(GType type, GQuark quark, void* data)

Attaches arbitrary data to a type.

testFlags
bool testFlags(GType type, uint flags)

Meta