gtype.h File Reference

__G_TYPE_H__

G_TYPE_FUNDAMENTAL

G_TYPE_FUNDAMENTAL: : A GType value.

The fundamental type which is the ancestor of . Fundamental types are types that serve as ultimate bases for the derived types, thus they are the roots of distinct inheritance hierarchies.

G_TYPE_FUNDAMENTAL_MAX

G_TYPE_FUNDAMENTAL_MAX:

An integer constant that represents the number of identifiers reserved for types that are assigned at compile-time.

G_TYPE_INVALID

G_TYPE_INVALID:

An invalid GType used as error return value in some functions which return a GType.

G_TYPE_NONE

G_TYPE_NONE:

A fundamental type which is used as a replacement for the C <literal>void</literal> return type.

G_TYPE_INTERFACE

G_TYPE_INTERFACE:

The fundamental type from which all interfaces are derived.

G_TYPE_CHAR

G_TYPE_CHAR:

The fundamental type corresponding to gchar. The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer. This may or may not be the same type a the C type "gchar".

G_TYPE_UCHAR

G_TYPE_UCHAR:

The fundamental type corresponding to guchar.

G_TYPE_BOOLEAN

G_TYPE_BOOLEAN:

The fundamental type corresponding to gboolean.

G_TYPE_INT

G_TYPE_INT:

The fundamental type corresponding to gint.

G_TYPE_UINT

G_TYPE_UINT:

The fundamental type corresponding to guint.

G_TYPE_LONG

G_TYPE_LONG:

The fundamental type corresponding to glong.

G_TYPE_ULONG

G_TYPE_ULONG:

The fundamental type corresponding to gulong.

G_TYPE_INT64

G_TYPE_INT64:

The fundamental type corresponding to gint64.

G_TYPE_UINT64

G_TYPE_UINT64:

The fundamental type corresponding to guint64.

G_TYPE_ENUM

G_TYPE_ENUM:

The fundamental type from which all enumeration types are derived.

G_TYPE_FLAGS

G_TYPE_FLAGS:

The fundamental type from which all flags types are derived.

G_TYPE_FLOAT

G_TYPE_FLOAT:

The fundamental type corresponding to gfloat.

G_TYPE_DOUBLE

G_TYPE_DOUBLE:

The fundamental type corresponding to gdouble.

G_TYPE_STRING

G_TYPE_STRING:

The fundamental type corresponding to nul-terminated C strings.

G_TYPE_POINTER

G_TYPE_POINTER:

The fundamental type corresponding to gpointer.

G_TYPE_BOXED

G_TYPE_BOXED:

The fundamental type from which all boxed types are derived.

G_TYPE_PARAM

G_TYPE_PARAM:

The fundamental type from which all GParamSpec types are derived.

G_TYPE_OBJECT

G_TYPE_OBJECT:

The fundamental type for GObject.

G_TYPE_FUNDAMENTAL_SHIFT

G_TYPE_FUNDAMENTAL_SHIFT:

Shift value used in converting numbers to type IDs.

G_TYPE_MAKE_FUNDAMENTAL

G_TYPE_MAKE_FUNDAMENTAL: : the fundamental type number.

Get the type ID for the fundamental type number . Use g_type_fundamental_next() instead of this macro to create new fundamental types.

Returns: the GType

G_TYPE_RESERVED_GLIB_FIRST

G_TYPE_RESERVED_GLIB_FIRST:

First fundamental type number to create a new fundamental type id with G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.

G_TYPE_RESERVED_GLIB_LAST

G_TYPE_RESERVED_GLIB_LAST:

Last fundamental type number reserved for GLib.

G_TYPE_RESERVED_BSE_FIRST

G_TYPE_RESERVED_BSE_FIRST:

First fundamental type number to create a new fundamental type id with G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.

G_TYPE_RESERVED_BSE_LAST

G_TYPE_RESERVED_BSE_LAST:

Last fundamental type number reserved for BSE.

G_TYPE_RESERVED_USER_FIRST

G_TYPE_RESERVED_USER_FIRST:

First available fundamental type number to create new fundamental type id with G_TYPE_MAKE_FUNDAMENTAL().

G_TYPE_IS_FUNDAMENTAL

G_TYPE_IS_FUNDAMENTAL: : A GType value.

Checks if is a fundamental type.

Returns: TRUE on success.

G_TYPE_IS_DERIVED

G_TYPE_IS_DERIVED: : A GType value.

Checks if is derived (or in object-oriented terminology: inherited) from another type (this holds true for all non-fundamental types).

Returns: TRUE on success.

G_TYPE_IS_INTERFACE

G_TYPE_IS_INTERFACE: : A GType value.

Checks if is an interface type. An interface type provides a pure API, the implementation of which is provided by another type (which is then said to conform to the interface). GLib interfaces are somewhat analogous to Java interfaces and C++ classes containing only pure virtual functions, with the difference that GType interfaces are not derivable (but see g_type_interface_add_prerequisite() for an alternative).

Returns: TRUE on success.

G_TYPE_IS_CLASSED

G_TYPE_IS_CLASSED: : A GType value.

Checks if is a classed type.

Returns: TRUE on success.

G_TYPE_IS_INSTANTIATABLE

G_TYPE_IS_INSTANTIATABLE: : A GType value.

Checks if can be instantiated. Instantiation is the process of creating an instance (object) of this type.

Returns: TRUE on success.

G_TYPE_IS_DERIVABLE

G_TYPE_IS_DERIVABLE: : A GType value.

Checks if is a derivable type. A derivable type can be used as the base class of a flat (single-level) class hierarchy.

Returns: TRUE on success.

G_TYPE_IS_DEEP_DERIVABLE

G_TYPE_IS_DEEP_DERIVABLE: : A GType value.

Checks if is a deep derivable type. A deep derivable type can be used as the base class of a deep (multi-level) class hierarchy.

Returns: TRUE on success.

G_TYPE_IS_ABSTRACT

G_TYPE_IS_ABSTRACT: : A GType value.

Checks if is an abstract type. An abstract type can not be instantiated and is normally used as an abstract base class for derived classes.

Returns: TRUE on success.

G_TYPE_IS_VALUE_ABSTRACT

G_TYPE_IS_VALUE_ABSTRACT: : A GType value.

Checks if is an abstract value type. An abstract value type introduces a value table, but can't be used for g_value_init() and is normally used as an abstract base type for derived value types.

Returns: TRUE on success.

G_TYPE_IS_VALUE_TYPE

G_TYPE_IS_VALUE_TYPE: : A GType value.

Checks if is a value type and can be used with g_value_init().

Returns: TRUE on success.

G_TYPE_HAS_VALUE_TABLE

G_TYPE_HAS_VALUE_TABLE: : A GType value.

Checks if has a GTypeValueTable.

Returns: TRUE on success.

Typedef GType

typedef gulong GType

GType:

A numerical value which represents the unique identifier of a registered type.

Typedef GValue

typedef struct _GValueGValue

Typedef GTypeCValue

typedef union _GTypeCValueGTypeCValue

Typedef GTypePlugin

typedef struct _GTypePluginGTypePlugin

Typedef GTypeClass

typedef struct _GTypeClassGTypeClass

Typedef GTypeInterface

typedef struct _GTypeInterfaceGTypeInterface

Typedef GTypeInstance

typedef struct _GTypeInstanceGTypeInstance

Typedef GTypeInfo

typedef struct _GTypeInfoGTypeInfo

Typedef GTypeFundamentalInfo

typedef struct _GTypeFundamentalInfoGTypeFundamentalInfo

Typedef GInterfaceInfo

typedef struct _GInterfaceInfoGInterfaceInfo

Typedef GTypeValueTable

typedef struct _GTypeValueTableGTypeValueTable

Typedef GTypeQuery

typedef struct _GTypeQueryGTypeQuery

G_TYPE_CHECK_INSTANCE

G_TYPE_CHECK_INSTANCE: : Location of a GTypeInstance structure.

Checks if is a valid GTypeInstance structure, otherwise issues a warning and returns FALSE.

This macro should only be used in type implementations.

Returns: TRUE on success.

G_TYPE_CHECK_INSTANCE_CAST

G_TYPE_CHECK_INSTANCE_CAST: : Location of a GTypeInstance structure. : The type to be returned. : The corresponding C type of .

Checks that is an instance of the type identified by and issues a warning if this is not the case. Returns casted to a pointer to .

This macro should only be used in type implementations.

G_TYPE_CHECK_INSTANCE_TYPE

G_TYPE_CHECK_INSTANCE_TYPE: : Location of a GTypeInstance structure. : The type to be checked

Checks if is an instance of the type identified by .

This macro should only be used in type implementations.

Returns: TRUE on success.

G_TYPE_INSTANCE_GET_CLASS

G_TYPE_INSTANCE_GET_CLASS: : Location of the GTypeInstance structure. : The GType of the class to be returned. : The C type of the class structure.

Get the class structure of a given , casted to a specified ancestor type of the instance.

Note that while calling a GInstanceInitFunc(), the class pointer gets modified, so it might not always return the expected pointer.

This macro should only be used in type implementations.

Returns: a pointer to the class structure

G_TYPE_INSTANCE_GET_INTERFACE

G_TYPE_INSTANCE_GET_INTERFACE: : Location of the GTypeInstance structure. : The GType of the interface to be returned. : The C type of the interface structure.

Get the interface structure for interface of a given .

This macro should only be used in type implementations.

Returns: a pointer to the interface structure

G_TYPE_CHECK_CLASS_CAST

G_TYPE_CHECK_CLASS_CAST: : Location of a GTypeClass structure. : The type to be returned. : The corresponding C type of class structure of .

Checks that is a class structure of the type identified by and issues a warning if this is not the case. Returns casted to a pointer to .

This macro should only be used in type implementations.

G_TYPE_CHECK_CLASS_TYPE

G_TYPE_CHECK_CLASS_TYPE: : Location of a GTypeClass structure. : The type to be checked.

Checks if is a class structure of the type identified by .

This macro should only be used in type implementations.

Returns: TRUE on success.

G_TYPE_CHECK_VALUE

G_TYPE_CHECK_VALUE: : a GValue

Checks if has been initialized to hold values of a value type.

This macro should only be used in type implementations.

Returns: TRUE on success.

G_TYPE_CHECK_VALUE_TYPE

G_TYPE_CHECK_VALUE_TYPE: : a GValue : The type to be checked.

Checks if has been initialized to hold values of type .

This macro should only be used in type implementations.

Returns: TRUE on success.

G_TYPE_FROM_INSTANCE

G_TYPE_FROM_INSTANCE: : Location of a valid GTypeInstance structure.

Get the type identifier from a given structure.

This macro should only be used in type implementations.

Returns: the GType

G_TYPE_FROM_CLASS

G_TYPE_FROM_INTERFACE

G_TYPE_INSTANCE_GET_PRIVATE

G_TYPE_INSTANCE_GET_PRIVATE: : the instance of a type deriving from . : the type identifying which private data to retrieve. : The C type for the private structure.

Gets the private structure for a particular type. The private structure must have been registered in the class_init function with g_type_class_add_private().

This macro should only be used in type implementations.

Since: 2.4 Returns: a pointer to the private data structure.

Enum GTypeDebugFlags

GTypeDebugFlags: : Print no messages. : Print messages about object bookkeeping. : Print messages about signal emissions. : Mask covering all debug flags.

The <type>GTypeDebugFlags</type> enumeration values can be passed to g_type_init_with_debug_flags() to trigger debugging messages during runtime. Note that the messages can also be triggered by setting the <envar>GOBJECT_DEBUG</envar> environment variable to a ':'-separated list of "objects" and "signals".

g_type_init ( void )

IMPORT_C voidg_type_init(void)

g_type_init:

Prior to any use of the type system, g_type_init() has to be called to initialize the type system and assorted other code portions (such as the various fundamental type implementations or the signal system).

g_type_init_with_debug_flags ( GTypeDebugFlags )

IMPORT_C voidg_type_init_with_debug_flags(GTypeDebugFlagsdebug_flags)

g_type_init_with_debug_flags: : Bitwise combination of GTypeDebugFlags values for debugging purposes.

Similar to g_type_init(), but additionally sets debug flags.

g_type_name ( GType )

IMPORT_C G_CONST_RETURN gchar *g_type_name(GTypetype)

g_type_name: : Type to return name for.

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.

Returns: Static type name or NULL.

g_type_qname ( GType )

IMPORT_C GQuarkg_type_qname(GTypetype)

g_type_qname: : Type to return quark of type name for.

Get the corresponding quark of the type IDs name.

Returns: The type names quark or 0.

g_type_from_name ( const gchar * )

IMPORT_C GTypeg_type_from_name(const gchar *name)

g_type_parent ( GType )

IMPORT_C GTypeg_type_parent(GTypetype)

g_type_parent: : The derived 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.

Returns: The parent type.

g_type_depth ( GType )

IMPORT_C guintg_type_depth(GTypetype)

g_type_depth: : A GType value.

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.

Returns: The depth of .

g_type_next_base ( GType, GType )

IMPORT_C GTypeg_type_next_base(GTypeleaf_type,
GTyperoot_type
)

g_type_next_base: : Descendant of and the type to be returned. : Immediate parent of the returned type.

Given a and a which is contained in its anchestry, return the type that is the immediate parent of. In other words, this function determines the type that is derived directly from which is also a base class of . 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.

Returns: Immediate child of and anchestor of .

g_type_is_a ( GType, GType )

IMPORT_C gbooleang_type_is_a(GTypetype,
GTypeis_a_type
)

g_type_is_a: : Type to check anchestry for. : Possible anchestor of or interface could conform to.

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

Returns: TRUE if is_a holds true.

g_type_class_ref ( GType )

IMPORT_C gpointerg_type_class_ref(GTypetype)

g_type_class_ref: : Type ID of a classed type.

Increments the reference count of the class structure belonging to . This function will demand-create the class if it doesn't exist already.

Returns: The GTypeClass structure for the given type ID.

g_type_class_peek ( GType )

IMPORT_C gpointerg_type_class_peek(GTypetype)

g_type_class_peek: : Type ID of a classed type.

This function is essentially the same as g_type_class_ref(), except that the classes reference count isn't incremented. As a consequence, this function may return NULL if the class of the type passed in does not currently exist (hasn't been referenced before).

Returns: The GTypeClass structure for the given type ID or NULL if the class does not currently exist.

g_type_class_peek_static ( GType )

IMPORT_C gpointerg_type_class_peek_static(GTypetype)

g_type_class_peek_static: : Type ID of a classed type.

A more efficient version of g_type_class_peek() which works only for static types.

Since: 2.4 Returns: The GTypeClass structure for the given type ID or NULL if the class does not currently exist or is dynamically loaded.

g_type_class_unref ( gpointer )

IMPORT_C voidg_type_class_unref(gpointerg_class)

g_type_class_unref: : The GTypeClass structure to unreference.

Decrements the reference count of the class structure being passed in. Once the last reference count of a class has been released, classes may be finalized by the type system, so further dereferencing of a class pointer after g_type_class_unref() are invalid.

g_type_class_peek_parent ( gpointer )

IMPORT_C gpointerg_type_class_peek_parent(gpointerg_class)

g_type_class_peek_parent: : The GTypeClass structure to retrieve the parent class for.

This is a convenience function often needed in class initializers. It returns the class structure of the immediate parent type of the class passed in. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist. This function is essentially equivalent to:

<programlisting> g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class))); </programlisting>

Returns: The parent class of .

g_type_interface_peek ( gpointer, GType )

IMPORT_C gpointerg_type_interface_peek(gpointerinstance_class,
GTypeiface_type
)

g_type_interface_peek: : A GTypeClass structure. : An interface ID which this class conforms to.

Returns the GTypeInterface structure of an interface to which the passed in class conforms.

Returns: The GTypeInterface structure of iface_type if implemented by , NULL otherwise

g_type_interface_peek_parent ( gpointer )

IMPORT_C gpointerg_type_interface_peek_parent(gpointerg_iface)

g_type_interface_peek_parent: : A GTypeInterface structure.

Returns the corresponding GTypeInterface structure of the parent type of the instance type to which belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.

Returns: The corresponding GTypeInterface structure of the parent type of the instance type to which belongs, or NULL if the parent type doesn't conform to the interface.

g_type_default_interface_ref ( GType )

IMPORT_C gpointerg_type_default_interface_ref(GTypeg_type)

g_type_default_interface_ref: : an interface type

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

If the type is not currently in use, then the default vtable for the type will be created and initalized by calling the base interface init and default vtable init functions for the type (the <structfield>base_init</structfield> and <structfield>class_init</structfield> members of GTypeInfo). Calling g_type_default_interface_ref() is useful when you want to make sure that signals and properties for an interface have been installed.

Since: 2.4

Returns: the default vtable for the interface; call g_type_default_interface_unref() when you are done using the interface.

g_type_default_interface_peek ( GType )

IMPORT_C gpointerg_type_default_interface_peek(GTypeg_type)

g_type_default_interface_peek: : an interface type

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

Since: 2.4

Returns: the default vtable for the interface, or NULL if the type is not currently in use.

g_type_default_interface_unref ( gpointer )

IMPORT_C voidg_type_default_interface_unref(gpointerg_iface)

g_type_default_interface_unref: : the default vtable structure for a interface, as returned by g_type_default_interface_ref()

Decrements the reference count for the type corresponding to the interface default vtable . 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 <structfield>class_finalize</structfield> member of GTypeInfo) will be called.

Since: 2.4

g_type_children ( GType, guint * )

IMPORT_C GType *g_type_children(GTypetype,
guint *n_children
)

g_type_children: : The parent type. : Optional guint pointer to contain the number of child types.

Return a newly allocated and 0-terminated array of type IDs, listing the child types of . The return value has to be g_free()ed after use.

Returns: Newly allocated and 0-terminated array of child types.

g_type_interfaces ( GType, guint * )

IMPORT_C GType *g_type_interfaces(GTypetype,
guint *n_interfaces
)

g_type_interfaces: : The type to list interface types for. : Optional guint pointer to contain the number of interface types.

Return a newly allocated and 0-terminated array of type IDs, listing the interface types that conforms to. The return value has to be g_free()ed after use.

Returns: Newly allocated and 0-terminated array of interface types.

g_type_set_qdata ( GType, GQuark, gpointer )

IMPORT_C voidg_type_set_qdata(GTypetype,
GQuarkquark,
gpointerdata
)

g_type_set_qdata: : a GType : a GQuark id to identify the data : the data

Attaches arbitrary data to a type.

g_type_get_qdata ( GType, GQuark )

IMPORT_C gpointerg_type_get_qdata(GTypetype,
GQuarkquark
)

g_type_get_qdata: : a GType : a GQuark id to identify the data

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

Returns: the data, or NULL if no data was found

g_type_query ( GType, GTypeQuery * )

IMPORT_C voidg_type_query(GTypetype,
GTypeQuery *query
)

g_type_query: : the GType value of a static, classed type. : A user provided structure that is filled in with constant values upon success.

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 member of the GTypeQuery is 0. All members filled into the GTypeQuery structure should be considered constant and have to be left untouched.

Typedef GBaseInitFunc

typedef void(*GBaseInitFunc

GBaseInitFunc: : The GTypeClass structure to initialize.

A callback function used by the type system to do base initialization of the class structures of derived types. It is called as part of the initialization process of all derived classes and should reallocate or reset all dynamic class members copied over from the parent class. For example, class members (such as strings) that are not sufficiently handled by a plain memory copy of the parent class into the derived class have to be altered. See GClassInitFunc() for a discussion of the class intialization process.

Typedef GBaseFinalizeFunc

typedef void(*GBaseFinalizeFunc

GBaseFinalizeFunc: : The GTypeClass structure to finalize.

A callback function used by the type system to finalize those portions of a derived types class structure that were setup from the corresponding GBaseInitFunc() function. Class finalization basically works the inverse way in which class intialization is performed. See GClassInitFunc() for a discussion of the class intialization process.

Typedef GClassInitFunc

typedef void(*GClassInitFunc

GClassInitFunc: : The GTypeClass structure to initialize. : The member supplied via the GTypeInfo structure.

A callback function used by the type system to initialize the class of a specific type. This function should initialize all static class members. The initialization process of a class involves: <itemizedlist> <listitem>

1 - Copying common members from the parent class over to the derived class structure.

</listitem> <listitem>

2 - Zero initialization of the remaining members not copied over from the parent class.

</listitem> <listitem>

3 - Invocation of the GBaseInitFunc() initializers of all parent types and the class' type.

</listitem> <listitem>

4 - Invocation of the class' GClassInitFunc() initializer.

</listitem> </itemizedlist> Since derived classes are partially initialized through a memory copy of the parent class, the general rule is that GBaseInitFunc() and GBaseFinalizeFunc() should take care of necessary reinitialization and release of those class members that were introduced by the type that specified these GBaseInitFunc()/GBaseFinalizeFunc(). GClassInitFunc() should only care about initializing static class members, while dynamic class members (such as allocated strings or reference counted resources) are better handled by a GBaseInitFunc() for this type, so proper initialization of the dynamic class members is performed for class initialization of derived types as well. An example may help to correspond the intend of the different class initializers:

|[ typedef struct { GObjectClass parent_class; gint static_integer; gchar *dynamic_string; } TypeAClass; static void type_a_base_class_init (TypeAClass *class) { class->dynamic_string = g_strdup ("some string"); } static void type_a_base_class_finalize (TypeAClass *class) { g_free (class->dynamic_string); } static void type_a_class_init (TypeAClass *class) { class->static_integer = 42; }

typedef struct { TypeAClass parent_class; gfloat static_float; GString *dynamic_gstring; } TypeBClass; static void type_b_base_class_init (TypeBClass *class) { class->dynamic_gstring = g_string_new ("some other string"); } static void type_b_base_class_finalize (TypeBClass *class) { g_string_free (class->dynamic_gstring); } static void type_b_class_init (TypeBClass *class) { class->static_float = 3.14159265358979323846; } ]| Initialization of TypeBClass will first cause initialization of TypeAClass (derived classes reference their parent classes, see g_type_class_ref() on this). Initialization of TypeAClass roughly involves zero-initializing its fields, then calling its GBaseInitFunc() type_a_base_class_init() to allocate its dynamic members (dynamic_string), and finally calling its GClassInitFunc() type_a_class_init() to initialize its static members (static_integer). The first step in the initialization process of TypeBClass is then a plain memory copy of the contents of TypeAClass into TypeBClass and zero-initialization of the remaining fields in TypeBClass. The dynamic members of TypeAClass within TypeBClass now need reinitialization which is performed by calling type_a_base_class_init() with an argument of TypeBClass. After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init() is called to allocate the dynamic members of TypeBClass (dynamic_gstring), and finally the GClassInitFunc() of TypeBClass, type_b_class_init(), is called to complete the initialization process with the static members (static_float). Corresponding finalization counter parts to the GBaseInitFunc() functions have to be provided to release allocated resources at class finalization time.

Typedef GClassFinalizeFunc

typedef void(*GClassFinalizeFunc

GClassFinalizeFunc: : The GTypeClass structure to finalize. : The member supplied via the GTypeInfo structure.

A callback function used by the type system to finalize a class. This function is rarely needed, as dynamically allocated class resources should be handled by GBaseInitFunc() and GBaseFinalizeFunc(). Also, specification of a GClassFinalizeFunc() in the GTypeInfo structure of a static type is invalid, because classes of static types will never be finalized (they are artificially kept alive when their reference count drops to zero).

Typedef GInstanceInitFunc

typedef void(*GInstanceInitFunc

GInstanceInitFunc: : The instance to initialize. : The class of the type the instance is created for.

A callback function used by the type system to initialize a new instance of a type. This function initializes all instance members and allocates any resources required by it. Initialization of a derived instance involves calling all its parent types instance initializers, so the class member of the instance is altered during its initialization to always point to the class that belongs to the type the current initializer was introduced for.

Typedef GInterfaceInitFunc

typedef void(*GInterfaceInitFunc

GInterfaceInitFunc: : The interface structure to initialize. : The supplied via the GInterfaceInfo structure.

A callback function used by the type system to initialize a new interface. This function should initialize all internal data and allocate any resources required by the interface.

Typedef GInterfaceFinalizeFunc

typedef void(*GInterfaceFinalizeFunc

GInterfaceFinalizeFunc: : The interface structure to finalize. : The supplied via the GInterfaceInfo structure.

A callback function used by the type system to finalize an interface. This function should destroy any internal data and release any resources allocated by the corresponding GInterfaceInitFunc() function.

Typedef GTypeClassCacheFunc

typedef gboolean(*GTypeClassCacheFunc

GTypeClassCacheFunc: : data that was given to the g_type_add_class_cache_func() call : The GTypeClass structure which is unreferenced

A callback function which is called when the reference count of a class drops to zero. It may use g_type_class_ref() to prevent the class from being freed. You should not call g_type_class_unref() from a GTypeClassCacheFunc function to prevent infinite recursion, use g_type_class_unref_uncached() instead.

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.

Returns: TRUE to stop further #GTypeClassCacheFuncs from being called, FALSE to continue.

Typedef GTypeInterfaceCheckFunc

typedef void(*GTypeInterfaceCheckFunc

GTypeInterfaceCheckFunc: : data passed to g_type_add_interface_check(). : the interface that has been initialized

A callback called after an interface vtable is initialized. See g_type_add_interface_check().

Since: 2.4

Enum GTypeFundamentalFlags

GTypeFundamentalFlags: : Indicates a classed type. : Indicates an instantiable type (implies classed). : Indicates a flat derivable type. : Indicates a deep derivable type (implies derivable).

Bit masks used to check or determine specific characteristics of a fundamental type.

EnumeratorValueDescription
G_TYPE_FLAG_CLASSED(1 << 0)
G_TYPE_FLAG_INSTANTIATABLE(1 << 1)
G_TYPE_FLAG_DERIVABLE(1 << 2)
G_TYPE_FLAG_DEEP_DERIVABLE(1 << 3)

Enum GTypeFlags

GTypeFlags: : Indicates an abstract type. No instances can be created for an abstract type. : Indicates an abstract value type, i.e. a type that introduces a value table, but can't be used for g_value_init().

Bit masks used to check or determine characteristics of a type.

EnumeratorValueDescription
G_TYPE_FLAG_ABSTRACT(1 << 4)
G_TYPE_FLAG_VALUE_ABSTRACT(1 << 5)

g_type_register_static ( GType, const gchar *, const GTypeInfo *, GTypeFlags )

IMPORT_C GTypeg_type_register_static(GTypeparent_type,
const gchar *type_name,
const GTypeInfo *info,
GTypeFlagsflags
)

g_type_register_static: : Type from which this type will be derived. : 0-terminated string used as the name of the new type. : The GTypeInfo structure for this type. : Bitwise combination of GTypeFlags values.

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

Returns: The new type identifier.

g_type_register_static_simple ( GType, const gchar *, guint, GClassInitFunc, guint, GInstanceInitFunc, GTypeFlags )

IMPORT_C GTypeg_type_register_static_simple(GTypeparent_type,
const gchar *type_name,
guintclass_size,
GClassInitFuncclass_init,
guintinstance_size,
GInstanceInitFuncinstance_init,
GTypeFlagsflags
)

g_type_register_static_simple: : Type from which this type will be derived. : 0-terminated string used as the name of the new type. : Size of the class structure (see GTypeInfo) : Location of the class initialization function (see GTypeInfo) : Size of the instance structure (see GTypeInfo) : Location of the instance initialization function (see GTypeInfo) : Bitwise combination of GTypeFlags values.

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

Since: 2.12

Returns: The new type identifier.

g_type_register_dynamic ( GType, const gchar *, GTypePlugin *, GTypeFlags )

IMPORT_C GTypeg_type_register_dynamic(GTypeparent_type,
const gchar *type_name,
GTypePlugin *plugin,
GTypeFlagsflags
)

g_type_register_dynamic: : Type from which this type will be derived. : 0-terminated string used as the name of the new type. : The GTypePlugin structure to retrieve the GTypeInfo from. : Bitwise combination of GTypeFlags values.

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

Returns: The new type identifier or G_TYPE_INVALID if registration failed.

g_type_register_fundamental ( GType, const gchar *, const GTypeInfo *, const GTypeFundamentalInfo *, GTypeFlags )

IMPORT_C GTypeg_type_register_fundamental(GTypetype_id,
const gchar *type_name,
const GTypeInfo *info,
const GTypeFundamentalInfo *finfo,
GTypeFlagsflags
)

g_type_register_fundamental: : A predefined type identifier. : 0-terminated string used as the name of the new type. : The GTypeInfo structure for this type. : The GTypeFundamentalInfo structure for this type. : Bitwise combination of GTypeFlags values.

Registers as the predefined identifier and as the name of a fundamental type. The type system uses the information contained in the GTypeInfo structure pointed to by and the GTypeFundamentalInfo structure pointed to by to manage the type and its instances. The value of determines additional characteristics of the fundamental type.

Returns: The predefined type identifier.

g_type_add_interface_static ( GType, GType, const GInterfaceInfo * )

IMPORT_C voidg_type_add_interface_static(GTypeinstance_type,
GTypeinterface_type,
const GInterfaceInfo *info
)

g_type_add_interface_static: : GType value of an instantiable type. : GType value of an interface type. : The GInterfaceInfo structure for this (, ) combination.

Adds the static to . The information contained in the #GTypeInterfaceInfo structure pointed to by is used to manage the relationship.

g_type_add_interface_dynamic ( GType, GType, GTypePlugin * )

IMPORT_C voidg_type_add_interface_dynamic(GTypeinstance_type,
GTypeinterface_type,
GTypePlugin *plugin
)

g_type_add_interface_dynamic: : the GType value of an instantiable type. : the GType value of an interface type. : the GTypePlugin structure to retrieve the GInterfaceInfo from.

Adds the dynamic to . The information contained in the GTypePlugin structure pointed to by is used to manage the relationship.

g_type_interface_add_prerequisite ( GType, GType )

IMPORT_C voidg_type_interface_add_prerequisite(GTypeinterface_type,
GTypeprerequisite_type
)

g_type_interface_add_prerequisite: : GType value of an interface type. : GType value of an interface or instantiatable type.

Adds to the list of prerequisites of . This means that any type implementing must also implement . Prerequisites can be thought of as an alternative to interface derivation (which GType doesn't support). An interface can have at most one instantiatable prerequisite type.

g_type_interface_prerequisites ( GType, guint * )

IMPORT_C GType *g_type_interface_prerequisites(GTypeinterface_type,
guint *n_prerequisites
)

g_type_interface_prerequisites: : an interface type : location to return the number of prerequisites, or NULL

Returns the prerequisites of an interfaces type.

Since: 2.2

Returns: a newly-allocated zero-terminated array of GType containing the prerequisites of

g_type_class_add_private ( gpointer, gsize )

IMPORT_C voidg_type_class_add_private(gpointerg_class,
gsizeprivate_size
)

g_type_class_add_private: : class structure for an instantiatable type : size of private structure.

Registers a private structure for an instantiatable type; when an object is allocated, the private structures for the type and all of its parent types are allocated sequentially in the same memory block as the public structures. This function should be called in the type's class_init() function. The private structure can be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro. The following example shows attaching a private structure <structname>MyObjectPrivate</structname> to an object <structname>MyObject</structname> defined in the standard GObject fashion.

|[ typedef struct _MyObjectPrivate MyObjectPrivate;

struct _MyObjectPrivate { int some_field; };

#define MY_OBJECT_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))

static void my_object_class_init (MyObjectClass *klass) { g_type_class_add_private (klass, sizeof (MyObjectPrivate)); }

static int my_object_get_some_field (MyObject *my_object) { MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);

return priv->some_field; } ]|

Since: 2.4

g_type_instance_get_private ( GTypeInstance *, GType )

IMPORT_C gpointerg_type_instance_get_private(GTypeInstance *instance,
GTypeprivate_type
)

G_DEFINE_TYPE

G_DEFINE_TYPE: : The name of the new type, in Camel case. : The name of the new type, in lowercase, with words separated by '_'. : The GType of the parent type.

A convenience macro for type implementations, which declares a class initialization function, an instance initialization function (see GTypeInfo for information about these) and a static variable named pointing to the parent class. Furthermore, it defines a *_get_type() function. See G_DEFINE_TYPE_EXTENDED() for an example.

Since: 2.4

G_DEFINE_TYPE_WITH_CODE

G_DEFINE_TYPE_WITH_CODE: : The name of the new type, in Camel case. : The name of the new type in lowercase, with words separated by '_'. : The GType of the parent type. : Custom code that gets inserted in the *_get_type() function.

A convenience macro for type implementations. Similar to G_DEFINE_TYPE(), but allows to insert custom code into the *_get_type() function, e.g. interface implementations via G_IMPLEMENT_INTERFACE(). See G_DEFINE_TYPE_EXTENDED() for an example.

Since: 2.4

G_DEFINE_ABSTRACT_TYPE

G_DEFINE_ABSTRACT_TYPE: : The name of the new type, in Camel case. : The name of the new type, in lowercase, with words separated by '_'. : The GType of the parent type.

A convenience macro for type implementations. Similar to G_DEFINE_TYPE(), but defines an abstract type. See G_DEFINE_TYPE_EXTENDED() for an example.

Since: 2.4

G_DEFINE_ABSTRACT_TYPE_WITH_CODE

G_DEFINE_ABSTRACT_TYPE_WITH_CODE: : The name of the new type, in Camel case. : The name of the new type, in lowercase, with words separated by '_'. : The GType of the parent type. : Custom code that gets inserted in the () function.

A convenience macro for type implementations. Similar to G_DEFINE_TYPE_WITH_CODE(), but defines an abstract type and allows to insert custom code into the *_get_type() function, e.g. interface implementations via G_IMPLEMENT_INTERFACE(). See G_DEFINE_TYPE_EXTENDED() for an example.

Since: 2.4

G_DEFINE_TYPE_EXTENDED

G_DEFINE_TYPE_EXTENDED: : The name of the new type, in Camel case. : The name of the new type, in lowercase, with words separated by '_'. : The GType of the parent type. : GTypeFlags to pass to g_type_register_static() : Custom code that gets inserted in the *_get_type() function.

The most general convenience macro for type implementations, on which G_DEFINE_TYPE(), etc are based.

|[ G_DEFINE_TYPE_EXTENDED (GtkGadget, gtk_gadget, GTK_TYPE_WIDGET, 0, G_IMPLEMENT_INTERFACE (TYPE_GIZMO, gtk_gadget_gizmo_init)); ]| expands to |[ static void gtk_gadget_init (GtkGadget *self); static void gtk_gadget_class_init (GtkGadgetClass *klass); static gpointer gtk_gadget_parent_class = NULL; static void gtk_gadget_class_intern_init (gpointer klass) { gtk_gadget_parent_class = g_type_class_peek_parent (klass); gtk_gadget_class_init ((GtkGadgetClass*) klass); }

GType gtk_gadget_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { GType g_define_type_id = g_type_register_static_simple (GTK_TYPE_WIDGET, g_intern_static_string ("GtkGadget"), sizeof (GtkGadgetClass), (GClassInitFunc) gtk_gadget_class_intern_init, sizeof (GtkGadget), (GInstanceInitFunc) gtk_gadget_init, (GTypeFlags) flags); { static const GInterfaceInfo g_implement_interface_info = { (GInterfaceInitFunc) gtk_gadget_gizmo_init }; g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info); } g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } ]| The only pieces which have to be manually provided are the definitions of the instance and class structure and the definitions of the instance and class init functions.

Since: 2.4

G_IMPLEMENT_INTERFACE

G_IMPLEMENT_INTERFACE: : The GType of the interface to add : The interface init function

A convenience macro to ease interface addition in the section of G_DEFINE_TYPE_WITH_CODE() or G_DEFINE_ABSTRACT_TYPE_WITH_CODE(). See G_DEFINE_TYPE_EXTENDED() for an example.

Note that this macro can only be used together with the G_DEFINE_TYPE_* macros, since it depends on variable names from those macros.

Since: 2.4

_G_DEFINE_TYPE_EXTENDED_BEGIN

_G_DEFINE_TYPE_EXTENDED_END

g_type_get_plugin ( GType )

IMPORT_C GTypePlugin *g_type_get_plugin(GTypetype)

g_type_get_plugin: : The GType to retrieve the plugin for.

Returns the GTypePlugin structure for or NULL if does not have a GTypePlugin structure.

Returns: The corresponding plugin if is a dynamic type, NULL otherwise.

g_type_interface_get_plugin ( GType, GType )

IMPORT_C GTypePlugin *g_type_interface_get_plugin(GTypeinstance_type,
GTypeinterface_type
)

g_type_interface_get_plugin: : the GType value of an instantiatable type. : the GType value of an interface type.

Returns the GTypePlugin structure for the dynamic interface which has been added to , or NULL if has not been added to or does not have a GTypePlugin structure. See g_type_add_interface_dynamic().

Returns: the GTypePlugin for the dynamic interface of .

g_type_fundamental_next ( void )

IMPORT_C GTypeg_type_fundamental_next(void)

g_type_fundamental_next:

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.

Returns: The nextmost fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs.

g_type_fundamental ( GType )

IMPORT_C GTypeg_type_fundamental(GTypetype_id)

g_type_fundamental: : valid type ID

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

Returns: fundamental type ID

g_type_create_instance ( GType )

IMPORT_C GTypeInstance *g_type_create_instance(GTypetype)

g_type_create_instance: : An instantiatable type to create an instance for.

Creates and initializes an instance of if 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 <emphasis>never</emphasis> directly through g_type_create_instance() which doesn't handle things like singleton objects or object construction. Note: Do <emphasis>not</emphasis> use this function, unless you're implementing a fundamental type. Also language bindings should <emphasis>not</emphasis> use this function but g_object_new() instead.

Returns: An allocated and initialized instance, subject to further treatment by the fundamental type implementation.

g_type_free_instance ( GTypeInstance * )

IMPORT_C voidg_type_free_instance(GTypeInstance *instance)

g_type_free_instance: : an instance of a type.

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

Like g_type_create_instance(), this function is reserved for implementors of fundamental types.

g_type_add_class_cache_func ( gpointer, GTypeClassCacheFunc )

IMPORT_C voidg_type_add_class_cache_func(gpointercache_data,
GTypeClassCacheFunccache_func
)

g_type_add_class_cache_func: : data to be passed to : a GTypeClassCacheFunc

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.

g_type_remove_class_cache_func ( gpointer, GTypeClassCacheFunc )

IMPORT_C voidg_type_remove_class_cache_func(gpointercache_data,
GTypeClassCacheFunccache_func
)

g_type_remove_class_cache_func: : data that was given when adding : a GTypeClassCacheFunc

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

g_type_class_unref_uncached ( gpointer )

IMPORT_C voidg_type_class_unref_uncached(gpointerg_class)

g_type_class_unref_uncached: : The GTypeClass structure to unreference.

A variant of g_type_class_unref() for use in GTypeClassCacheFunc implementations. It unreferences a class without consulting the chain of #GTypeClassCacheFuncs, avoiding the recursion which would occur otherwise.

g_type_add_interface_check ( gpointer, GTypeInterfaceCheckFunc )

IMPORT_C voidg_type_add_interface_check(gpointercheck_data,
GTypeInterfaceCheckFunccheck_func
)

g_type_add_interface_check: : data to pass to : function to be called after each interface is initialized.

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

This function is useful when you want to check an invariant that depends on the interfaces of a class. For instance, the implementation of GObject uses this facility to check that an object implements all of the properties that are defined on its interfaces.

Since: 2.4

g_type_remove_interface_check ( gpointer, GTypeInterfaceCheckFunc )

IMPORT_C voidg_type_remove_interface_check(gpointercheck_data,
GTypeInterfaceCheckFunccheck_func
)

g_type_remove_interface_check: : callback data passed to g_type_add_interface_check() : callback function passed to g_type_add_interface_check()

Removes an interface check function added with g_type_add_interface_check().

Since: 2.4

g_type_value_table_peek ( GType )

IMPORT_C GTypeValueTable *g_type_value_table_peek(GTypetype)

g_type_value_table_peek: : A GType value.

Returns the location of the GTypeValueTable associated with . <emphasis>Note that this function should only be used from source code that implements or has internal knowledge of the implementation of .</emphasis>

Returns: Location of the GTypeValueTable associated with or NULL if there is no GTypeValueTable associated with .

g_type_check_instance ( GTypeInstance * )

IMPORT_C gbooleang_type_check_instance(GTypeInstance *instance)

g_type_check_instance: : A valid GTypeInstance structure.

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

: TRUE if is valid, FALSE otherwise.

g_type_check_instance_cast ( GTypeInstance *, GType )

IMPORT_C GTypeInstance *g_type_check_instance_cast(GTypeInstance *instance,
GTypeiface_type
)

g_type_check_instance_is_a ( GTypeInstance *, GType )

IMPORT_C gbooleang_type_check_instance_is_a(GTypeInstance *instance,
GTypeiface_type
)

g_type_check_class_cast ( GTypeClass *, GType )

IMPORT_C GTypeClass *g_type_check_class_cast(GTypeClass *g_class,
GTypeis_a_type
)

g_type_check_class_is_a ( GTypeClass *, GType )

IMPORT_C gbooleang_type_check_class_is_a(GTypeClass *g_class,
GTypeis_a_type
)

g_type_check_is_value_type ( GType )

IMPORT_C gbooleang_type_check_is_value_type(GTypetype)

g_type_check_value ( GValue * )

IMPORT_C gbooleang_type_check_value(GValue *value)

g_type_check_value_holds ( GValue *, GType )

IMPORT_C gbooleang_type_check_value_holds(GValue *value,
GTypetype
)

g_type_test_flags ( GType, guint )

IMPORT_C gbooleang_type_test_flags(GTypetype,
guintflags
)

g_type_name_from_instance ( GTypeInstance * )

IMPORT_C G_CONST_RETURN gchar *g_type_name_from_instance(GTypeInstance *instance)

g_type_name_from_class ( GTypeClass * )

IMPORT_C G_CONST_RETURN gchar *g_type_name_from_class(GTypeClass *g_class)

g_value_c_init ( void )

G_GNUC_INTERNAL voidg_value_c_init(void)

g_value_types_init ( void )

G_GNUC_INTERNAL voidg_value_types_init(void)

g_enum_types_init ( void )

G_GNUC_INTERNAL voidg_enum_types_init(void)

g_param_type_init ( void )

G_GNUC_INTERNAL voidg_param_type_init(void)

g_boxed_type_init ( void )

G_GNUC_INTERNAL voidg_boxed_type_init(void)

g_object_type_init ( void )

G_GNUC_INTERNAL voidg_object_type_init(void)

g_param_spec_types_init ( void )

G_GNUC_INTERNAL voidg_param_spec_types_init(void)

g_value_transforms_init ( void )

G_GNUC_INTERNAL voidg_value_transforms_init(void)

g_signal_init ( void )

G_GNUC_INTERNAL voidg_signal_init(void)

_G_TYPE_CIC

_G_TYPE_CCC

_G_TYPE_CHI

_G_TYPE_CHV

_G_TYPE_IGC

_G_TYPE_IGI

_G_TYPE_CIT

_G_TYPE_CCT

_G_TYPE_CVH

G_TYPE_FLAG_RESERVED_ID_BIT

G_TYPE_FLAG_RESERVED_ID_BIT:

A bit in the type number that's supposed to be left untouched.

_g_type_debug_flags

GTypeDebugFlags _g_type_debug_flags