T-type
add-class-cache-func
Adds a Gnome::GObject::TypeClassCacheFunc 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 Gnome::GObject::TypeClassCacheFunc 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 Gnome::GObject::TypeClassCacheFunc chain.
method add-class-cache-func ( Pointer $cache_data, GTypeClassCacheFunc $cache_func )
Pointer $cache_data; data to be passed to cache-func
GTypeClassCacheFunc $cache_func; a Gnome::GObject::TypeClassCacheFunc
add-class-private
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.
This function should be called in the type's get-type() function after the type is registered. The private structure can be retrieved using the G-TYPE-CLASS-GET-PRIVATE() macro.
method add-class-private ( UInt $private_size )
UInt $private_size; size of private structure
add-instance-private
method add-instance-private ( UInt $private_size --> Int )
UInt $private_size;
add-interface-check
Adds a function to be called after an interface vtable is initialized for any class (i.e. after the interface-init member of Gnome::GObject::InterfaceInfo 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 Gnome::GObject::Object uses this facility to check that an object implements all of the properties that are defined on its interfaces.
method add-interface-check ( Pointer $check_data, GTypeInterfaceCheckFunc $check_func )
Pointer $check_data; data to pass to check-func
GTypeInterfaceCheckFunc $check_func; function to be called after each interface is initialized
add-interface-dynamic
Adds the dynamic interface-type to instantiable-type. The information contained in the Gnome::GObject::TypePlugin structure pointed to by plugin is used to manage the relationship.
method add-interface-dynamic ( N-Object $interface_type, N-Object $plugin )
N-Object $interface_type; Gnome::GObject::Type value of an interface type
N-Object $plugin; Gnome::GObject::TypePlugin structure to retrieve the Gnome::GObject::InterfaceInfo from
add-interface-static
Adds the static interface-type to instantiable-type. The information contained in the Gnome::GObject::InterfaceInfo structure pointed to by info is used to manage the relationship.
method add-interface-static ( N-Object $interface_type, GInterfaceInfo $info )
N-Object $interface_type; Gnome::GObject::Type value of an interface type
GInterfaceInfo $info; Gnome::GObject::InterfaceInfo structure for this (instance-type, interface-type) combination
check-class-cast
method check-class-cast ( GTypeClass $g_class, N-Object $is_a_type --> GTypeClass )
GTypeClass $g_class;
N-Object $is_a_type;
check-class-is-a
method check-class-is-a ( GTypeClass $g_class, N-Object $is_a_type --> Bool )
GTypeClass $g_class;
N-Object $is_a_type;
check-instance
Private helper function to aid implementation of the G-TYPE-CHECK-INSTANCE() macro.
Returns: True if instance is valid, False otherwise
method check-instance ( GTypeInstance $instance --> Bool )
GTypeInstance $instance; a valid Gnome::GObject::TypeInstance structure
check-instance-cast
Checks that instance is an instance of the type identified by g_type and issues a warning if this is not the case. Returns instance casted to a pointer to c_type.
No warning will be issued if instance is NULL, and NULL will be returned.
method check-instance-cast (
N-Object $instance, UInt $iface_type --> N-Object
)
N-Object $instance;
UInt $iface_type;
check-instance-is-a
Check if an instance is of type $iface-gtype. Returns True if it is.
method check-instance-is-a (
N-Object $instance, UInt $iface_gtype --> Bool
)
N-Object $instance;
UInt $iface_type;
check-instance-is-fundamentally-a
method check-instance-is-fundamentally-a ( GTypeInstance $instance, N-Object $fundamental_type --> Bool )
GTypeInstance $instance;
N-Object $fundamental_type;
check-value
method check-value ( N-Object $value --> Bool )
N-Object $value;
check-value-holds
method check-value-holds ( N-Object $value, N-Object $type --> Bool )
N-Object $value;
N-Object $type;
children
Return a newly allocated and 0-terminated array of type IDs, listing the child types of type.
Returns: (array length=n-children) : Newly allocated and 0-terminated array of child types, free with g-free()
method children ( guInt-ptr $n_children --> N-Object )
guInt-ptr $n_children; location to store the length of the returned array, or
undefined
class-adjust-private-offset
method class-adjust-private-offset ( Pointer $g_class )
Pointer $g_class;
Int $private_size_or_offset;
class-get-instance-private-offset
Gets the offset of the private data for instances of g-class.
This is how many bytes you should add to the instance pointer of a class in order to get the private data for the type represented by g-class.
You can only call this function after you have registered a private data area for g-class using class-add-private().
Returns: the offset, in bytes
method class-get-instance-private-offset ( Pointer $g_class --> Int )
Pointer $g_class; (type GObject.TypeClass): a Gnome::GObject::TypeClass
class-get-private
method class-get-private ( GTypeClass $klass, N-Object $private_type --> Pointer )
GTypeClass $klass;
N-Object $private_type;
class-peek
This function is essentially the same as class-ref(), except that the classes reference count isn't incremented. As a consequence, this function may return undefined if the class of the type passed in does not currently exist (hasn't been referenced before).
Returns: (type GObject.TypeClass) : the Gnome::GObject::TypeClass structure for the given type ID or undefined if the class does not currently exist
method class-peek ( --> Pointer )
class-peek-parent
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: class-peek (g-type-parent (G-TYPE-FROM-CLASS (g-class)))
Returns: (type GObject.TypeClass) : the parent class of g-class
method class-peek-parent ( Pointer $g_class --> Pointer )
Pointer $g_class; (type GObject.TypeClass): the Gnome::GObject::TypeClass structure to retrieve the parent class for
class-peek-static
A more efficient version of class-peek() which works only for static types.
Returns: (type GObject.TypeClass) : the Gnome::GObject::TypeClass structure for the given type ID or undefined if the class does not currently exist or is dynamically loaded
method class-peek-static ( --> Pointer )
class-ref
Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn't exist already.
Returns: (type GObject.TypeClass) : the Gnome::GObject::TypeClass structure for the given type ID
method class-ref ( --> Pointer )
class-unref
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 class-unref() are invalid.
method class-unref ( Pointer $g_class )
Pointer $g_class; (type GObject.TypeClass): a Gnome::GObject::TypeClass structure to unref
class-unref-uncached
A variant of class-unref() for use in Gnome::GObject::TypeClassCacheFunc implementations. It unreferences a class without consulting the chain of Gnome::GObject::TypeClassCacheFuncs, avoiding the recursion which would occur otherwise.
method class-unref-uncached ( Pointer $g_class )
Pointer $g_class; (type GObject.TypeClass): a Gnome::GObject::TypeClass structure to unref
create-instance
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 create-instance() is reserved for implementators of fundamental types only. E.g. instances of the Gnome::GObject::Object 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.
The extended members of the returned instance are guaranteed to be filled with zeros.
Note: Do not use this function, unless you're implementing a fundamental type. Also language bindings should not use this function, but g-object-new() instead.
Returns: an allocated and initialized instance, subject to further treatment by the fundamental type implementation
method create-instance ( --> GTypeInstance )
default-interface-peek
If the interface type g-type is currently in use, returns its default interface vtable.
Returns: (type GObject.TypeInterface) : the default vtable for the interface, or undefined if the type is not currently in use
method default-interface-peek ( --> Pointer )
default-interface-ref
Increments the reference count for the interface type g-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 base-init and class-init members of Gnome::GObject::TypeInfo). Calling default-interface-ref() is useful when you want to make sure that signals and properties for an interface have been installed.
Returns: (type GObject.TypeInterface) : the default vtable for the interface; call g-type-default-interface-unref() when you are done using the interface.
method default-interface-ref ( --> Pointer )
default-interface-unref
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 Gnome::GObject::TypeInfo) will be called.
method default-interface-unref ( Pointer $g_iface )
Pointer $g_iface; (type GObject.TypeInterface): the default vtable structure for a interface, as returned by
default-interface-ref()
depth
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 $gtype
method depth ( UInt $gtype --> UInt )
ensure
Ensures that the indicated type has been registered with the type system, and its -class-init() method has been run.
In theory, simply calling the type's -get-type() method (or using the corresponding macro) is supposed take care of this. However, -get-type() methods are often marked G-GNUC-CONST for performance reasons, even though this is technically incorrect (since G-GNUC-CONST requires that the function not have side effects, which -get-type() methods do on the first call). As a result, if you write a bare call to a -get-type() macro, it may get optimized out by the compiler. Using ensure() guarantees that the type's -get-type() method is called.
method ensure ( )
free-instance
Frees an instance of a type, returning it to the instance pool for the type, if there is one.
Like create-instance(), this function is reserved for implementors of fundamental types.
method free-instance ( GTypeInstance $instance )
GTypeInstance $instance; an instance of a type
from-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).
Returns: corresponding type ID or 0
method from-name ( Str $name --> UInt )
Str $name; type name to lookup
fundamental
Internal function, used to extract the fundamental type ID portion. Use G-TYPE-FUNDAMENTAL() instead.
Returns: fundamental type ID
method fundamental ( --> N-Object )
fundamental-next
Returns the next free fundamental type id which can be used to register a new fundamental type with register-fundamental(). The returned type ID represents the highest currently registered fundamental type identifier.
Returns: the next available fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs
method fundamental-next ( --> N-Object )
get-instance-count
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).
Returns: the number of instances allocated of the given type; if instance counts are not available, returns 0.
method get-instance-count ( --> Int )
get-plugin
Returns the Gnome::GObject::TypePlugin structure for type.
Returns: the corresponding plugin if type is a dynamic type, undefined otherwise
method get-plugin ( --> N-Object )
get-qdata
Obtains data which has previously been attached to type with set-qdata().
Note that this does not take subtyping into account; data attached to one type with g-type-set-qdata() cannot be retrieved from a subtype using g-type-get-qdata().
Returns: the data, or undefined if no data was found
method get-qdata ( UInt $quark --> Pointer )
UInt $quark; a Gnome::GObject::Quark id to identify the data
get-type-registration-serial
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 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.
Returns: An unsigned int, representing the state of type registrations
method get-type-registration-serial ( --> UInt )
gtype-get-type
Get dynamic type for a GTyped value. In C there is this name G_TYPE_GTYPE.
method gtype_get_type ( --> UInt )
instance-get-private
method instance-get-private ( GTypeInstance $instance, N-Object $private_type --> Pointer )
GTypeInstance $instance;
N-Object $private_type;
interface-add-prerequisite
Adds prerequisite-type to the list of prerequisites of interface-type. This means that any type implementing interface-type must also implement prerequisite-type. 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.
method interface-add-prerequisite ( N-Object $prerequisite_type )
N-Object $prerequisite_type; Gnome::GObject::Type value of an interface or instantiatable type
interface-get-plugin
Returns the Gnome::GObject::TypePlugin structure for the dynamic interface interface-type which has been added to instance-type, or undefined if interface-type has not been added to instance-type or does not have a Gnome::GObject::TypePlugin structure. See add-interface-dynamic().
Returns: the Gnome::GObject::TypePlugin for the dynamic interface interface-type of instance-type
method interface-get-plugin ( N-Object $interface_type --> N-Object )
N-Object $interface_type; Gnome::GObject::Type of an interface type
interface-peek
Returns the Gnome::GObject::TypeInterface structure of an interface to which the passed in class conforms.
Returns: (type GObject.TypeInterface) : the Gnome::GObject::TypeInterface structure of iface-type if implemented by instance-class, undefined otherwise
method interface-peek ( Pointer $instance_class, N-Object $iface_type --> Pointer )
Pointer $instance_class; (type GObject.TypeClass): a Gnome::GObject::TypeClass structure
N-Object $iface_type; an interface ID which this class conforms to
interface-peek-parent
Returns the corresponding Gnome::GObject::TypeInterface structure of the parent type of the instance type to which g-iface belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.
Returns: (type GObject.TypeInterface): the corresponding Gnome::GObject::TypeInterface structure of the parent type of the instance type to which g-iface belongs, or undefined if the parent type doesn't conform to the interface
method interface-peek-parent ( Pointer $g_iface --> Pointer )
Pointer $g_iface; (type GObject.TypeInterface): a Gnome::GObject::TypeInterface structure
interface-prerequisites
Returns the prerequisites of an interfaces type.
Returns: (array length=n-prerequisites) : a newly-allocated zero-terminated array of Gnome::GObject::Type containing the prerequisites of interface-type
method interface-prerequisites ( guInt-ptr $n_prerequisites --> N-Object )
guInt-ptr $n_prerequisites; location to return the number of prerequisites, or
undefined
interfaces
Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to.
Returns: (array length=n-interfaces) : Newly allocated and 0-terminated array of interface types, free with g-free()
method interfaces ( guInt-ptr $n_interfaces --> N-Object )
guInt-ptr $n_interfaces; location to store the length of the returned array, or
undefined
is-a
If $is-a-gtype is a derivable type, check whether $gtype is a descendant of $is-a-gtype. If $is-a-gtype is an interface, check whether $gtype conforms to it.
Returns: True if $gtype is a $is-a-gtype
method is-a ( UInt $gtype, UInt $is_a_gtype --> Bool )
UInt $is_a_gtype; possible anchestor of $gtype or interface that $gtype could conform to
name
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 undefined
method name ( UInt $gtype --> Str )
name-from-class
method name-from-class ( GTypeClass $g_class --> Str )
GTypeClass $g_class;
name-from-instance
Get name of type from the instance.
method name-from-instance ( N-Object $instance --> Str )
N-Object $instance;
next-base
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.
Returns: immediate child of root-type and anchestor of leaf-type
method next-base ( N-Object $root_type --> N-Object )
N-Object $root_type; immediate parent of the returned type
parent
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
method parent ( UInt $parent-gtype --> UInt )
qname
Get the corresponding quark of the type IDs name.
Returns: the type names quark or 0
method qname ( UInt $gtype --> UInt )
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 Gnome::GObject::Type is passed in, the $type member of the N-GTypeQuery is 0. All members filled into the N-GTypeQuery structure should be considered constant and have to be left untouched.
method query ( UInt $gtype --> N-GTypeQuery )
register-dynamic
Registers type-name as the name of a new dynamic type derived from parent-type. The type system uses the information contained in the Gnome::GObject::TypePlugin 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.
Returns: the new type identifier or Gnome::GObject::-TYPE-INVALID if registration failed
method register-dynamic ( Str $type_name, N-Object $plugin, GTypeFlags $flags --> N-Object )
Str $type_name; 0-terminated string used as the name of the new type
N-Object $plugin; Gnome::GObject::TypePlugin structure to retrieve the Gnome::GObject::TypeInfo from
GTypeFlags $flags; bitwise combination of Gnome::GObject::TypeFlags values
register-fundamental
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 Gnome::GObject::TypeInfo structure pointed to by info and the Gnome::GObject::TypeFundamentalInfo structure pointed to by finfo to manage the type and its instances. The value of flags determines additional characteristics of the fundamental type.
Returns: the predefined type identifier
method register-fundamental ( Str $type_name, GTypeInfo $info, GTypeFundamentalInfo $finfo, GTypeFlags $flags --> N-Object )
Str $type_name; 0-terminated string used as the name of the new type
GTypeInfo $info; Gnome::GObject::TypeInfo structure for this type
GTypeFundamentalInfo $finfo; Gnome::GObject::TypeFundamentalInfo structure for this type
GTypeFlags $flags; bitwise combination of Gnome::GObject::TypeFlags values
register-static
Registers type-name as the name of a new static type derived from parent-type. The type system uses the information contained in the Gnome::GObject::TypeInfo 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.
Returns: the new type identifier
method register-static ( Str $type_name, GTypeInfo $info, GTypeFlags $flags --> N-Object )
Str $type_name; 0-terminated string used as the name of the new type
GTypeInfo $info; Gnome::GObject::TypeInfo structure for this type
GTypeFlags $flags; bitwise combination of Gnome::GObject::TypeFlags values
register-static-simple
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 Gnome::GObject::TypeInfo struct and calling register-static().
Returns: the new type identifier
method register-static-simple ( Str $type_name, UInt $class_size, GClassInitFunc $class_init, UInt $instance_size, GInstanceInitFunc $instance_init, GTypeFlags $flags --> N-Object )
Str $type_name; 0-terminated string used as the name of the new type
UInt $class_size; size of the class structure (see Gnome::GObject::TypeInfo)
GClassInitFunc $class_init; location of the class initialization function (see Gnome::GObject::TypeInfo)
UInt $instance_size; size of the instance structure (see Gnome::GObject::TypeInfo)
GInstanceInitFunc $instance_init; location of the instance initialization function (see Gnome::GObject::TypeInfo)
GTypeFlags $flags; bitwise combination of Gnome::GObject::TypeFlags values
remove-class-cache-func
Removes a previously installed Gnome::GObject::TypeClassCacheFunc. The cache maintained by cache-func has to be empty when calling remove-class-cache-func() to avoid leaks.
method remove-class-cache-func ( Pointer $cache_data, GTypeClassCacheFunc $cache_func )
Pointer $cache_data; data that was given when adding cache-func
GTypeClassCacheFunc $cache_func; a Gnome::GObject::TypeClassCacheFunc
remove-interface-check
Removes an interface check function added with add-interface-check().
method remove-interface-check ( Pointer $check_data, GTypeInterfaceCheckFunc $check_func )
Pointer $check_data; callback data passed to
add-interface-check()GTypeInterfaceCheckFunc $check_func; callback function passed to
add-interface-check()
set-qdata
Attaches arbitrary data to a type.
method set-qdata ( UInt $quark, Pointer $data )
UInt $quark; a Gnome::GObject::Quark id to identify the data
Pointer $data; the data
value-table-peek
Returns the location of the Gnome::GObject::TypeValueTable associated with type.
Note that this function should only be used from source code that implements or has internal knowledge of the implementation of type.
Returns: location of the Gnome::GObject::TypeValueTable associated with type or undefined if there is no Gnome::GObject::TypeValueTable associated with type
method value-table-peek ( --> GTypeValueTable )
[g_] type_name
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 undefined
method g_type_name ( UInt $gtype --> Str )
[g_] type_qname
Get the corresponding quark of the type IDs name.
Returns: the type names quark or 0
method g_type_qname ( UInt $gtype --> UInt )
[[g_] type_] from_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).
Returns: corresponding type ID or 0
method g_type_from_name ( Str $name --> UInt )
Str $name; type name to lookup
[g_] type_parent
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
method g_type_parent ( UInt $parent-type --> UInt )
[g_] type_depth
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 $type
method g_type_depth ( UInt $type --> UInt )
[[g_] type_] is_a
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.
Returns: 1 if $type is a $is_a_type.
method g_type_is_a ( UInt $type, UInt $is_a_type --> Int )
UInt $is_a_type; possible anchestor of $type or interface that $type could conform to.
[g_] type_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 N-GTypeQuery is 0. All members filled into the N-GTypeQuery structure should be considered constant and have to be left untouched.
method g_type_query ( int32 $type --> N-GTypeQuery )
N-GTypeQuery $query; a structure that is filled in with constant values upon success
[[g_] type_] check_instance_cast
Checks that instance is an instance of the type identified by g_type and issues a warning if this is not the case. Returns instance casted to a pointer to c_type.
No warning will be issued if instance is NULL, and NULL will be returned.
This macro should only be used in type implementations.
method g_type_check_instance_cast (
N-Object $instance, UInt $iface_type
--> N-Object
)
N-Object $instance;
UInt $iface_type;
[[g_] type_] check_instance_is_a
method g_type_check_instance_is_a (
N-Object $instance, UInt $iface_type --> Int
)
N-Object $instance; the native object to check.
UInt $iface_type; the gtype the instance is inheriting from.
[[g_] type_] name_from_instance
Get name of type from the instance.
method g_type_name_from_instance ( N-Object $instance --> Str )
int32 $instance;
Returns the name of the instance.
[g_] gtype_get_type
Get dynamic type for a GTyped value. In C there is this name G_TYPE_GTYPE.
method g_gtype_get_type ( --> UInt )
[[g_] type_] name_from_class
method g_type_name_from_class ( int32 $g_class --> Str )
int32 $g_class;
[[g_] type_] check_instance_is_fundamentally_a
method g_type_check_instance_is_fundamentally_a ( int32 $instance, int32 $fundamental_type --> Int )
int32 $instance;
int32 $fundamental_type;
[[g_] type_] check_class_cast
method g_type_check_class_cast ( int32 $g_class, int32 $is_a_type --> int32 )
int32 $g_class;
int32 $is_a_type;
[[g_] type_] check_class_is_a
method g_type_check_class_is_a ( int32 $g_class, int32 $is_a_type --> Int )
int32 $g_class;
int32 $is_a_type;
[[g_] type_] check_value
Checks if value has been initialized to hold values of type g_type.
method g_type_check_value ( N-Object $value --> Int )
N-Object $value;
[[g_] type_] check_value_holds
method g_type_check_value_holds ( N-Object $value, int32 $type --> Int )
N-Object $value;
int32 $type;
[[g_] type_] get_instance_count
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).
Returns: the number of instances allocated of the given type; if instance counts are not available, returns 0.
method g_type_get_instance_count ( --> int32 )
[[g_] type_] register_static
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.
Returns: the new type identifier
method g_type_register_static ( Str $type_name, int32 $info, int32 $flags --> int32 )
Str $type_name; 0-terminated string used as the name of the new type
int32 $info; GTypeInfo structure for this type
int32 $flags; bitwise combination of GTypeFlags values
[[g_] type_] register_static_simple
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().
Returns: the new type identifier
method g_type_register_static_simple ( Str $type_name, UInt $class_size, GClassInitFunc $class_init, UInt $instance_size, GInstanceInitFunc $instance_init, int32 $flags --> int32 )
Str $type_name; 0-terminated string used as the name of the new type
UInt $class_size; size of the class structure (see GTypeInfo)
GClassInitFunc $class_init; location of the class initialization function (see GTypeInfo)
UInt $instance_size; size of the instance structure (see GTypeInfo)
GInstanceInitFunc $instance_init; location of the instance initialization function (see GTypeInfo)
int32 $flags; bitwise combination of GTypeFlags values
[[g_] type_] register_dynamic
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.
Returns: the new type identifier or G_TYPE_INVALID if registration failed
method g_type_register_dynamic ( Str $type_name, int32 $plugin, int32 $flags --> int32 )
Str $type_name; 0-terminated string used as the name of the new type
int32 $plugin; GTypePlugin structure to retrieve the GTypeInfo from
int32 $flags; bitwise combination of GTypeFlags values
[[g_] type_] register_fundamental
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.
Returns: the predefined type identifier
method g_type_register_fundamental ( Str $type_name, int32 $info, int32 $finfo, int32 $flags --> int32 )
Str $type_name; 0-terminated string used as the name of the new type
int32 $info; GTypeInfo structure for this type
int32 $finfo; GTypeFundamentalInfo structure for this type
int32 $flags; bitwise combination of GTypeFlags values
[[g_] type_] add_interface_static
Adds the static interface_type to instantiable_type. The information contained in the N-GInterfaceInfo structure pointed to by info is used to manage the relationship.
method g_type_add_interface_static ( int32 $interface_type, N-GInterfaceInfo $info )
int32 $interface_type; GType value of an interface type
N-GInterfaceInfo $info; N-GInterfaceInfo structure for this (instance_type, interface_type) combination
[[g_] type_] add_interface_dynamic
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.
method g_type_add_interface_dynamic ( int32 $interface_type, int32 $plugin )
int32 $interface_type; GType value of an interface type
int32 $plugin; GTypePlugin structure to retrieve the N-GInterfaceInfo from
[[g_] type_] interface_add_prerequisite
Adds prerequisite_type to the list of prerequisites of interface_type. This means that any type implementing interface_type must also implement prerequisite_type. 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.
method g_type_interface_add_prerequisite ( int32 $prerequisite_type )
int32 $prerequisite_type; GType value of an interface or instantiatable type
[[g_] type_] interface_prerequisites
Returns the prerequisites of an interfaces type.
Returns: (array length=n_prerequisites) (transfer full): a newly-allocated zero-terminated array of GType containing the prerequisites of interface_type
method g_type_interface_prerequisites ( UInt $n_prerequisites --> int32 )
UInt $n_prerequisites; (out) (optional): location to return the number of prerequisites, or
Any
[[g_] type_] add_instance_private
method g_type_add_instance_private ( UInt $private_size --> Int )
UInt $private_size;
[[g_] type_] instance_get_private
method g_type_instance_get_private ( int32 $instance, int32 $private_type --> Pointer )
int32 $instance;
int32 $private_type;
[[g_] type_] class_adjust_private_offset
method g_type_class_adjust_private_offset ( Pointer $g_class, Int $private_size_or_offset )
Pointer $g_class;
Int $private_size_or_offset;
[[g_] type_] add_class_private
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.
This function should be called in the
type's get_type() function after the type is registered.
The private structure can be retrieved using the
G_TYPE_CLASS_GET_PRIVATE() macro.
method g_type_add_class_private ( UInt $private_size )
UInt $private_size; size of private structure
[[g_] type_] class_get_private
method g_type_class_get_private ( int32 $klass, int32 $private_type --> Pointer )
int32 $klass;
int32 $private_type;
[[g_] type_] class_get_instance_private_offset
Gets the offset of the private data for instances of g_class.
This is how many bytes you should add to the instance pointer of a class in order to get the private data for the type represented by g_class.
You can only call this function after you have registered a private
data area for g_class using g_type_class_add_private().
Returns: the offset, in bytes
method g_type_class_get_instance_private_offset ( Pointer $g_class --> Int )
Pointer $g_class; (type GObject.TypeClass): a N-GTypeClass
[g_] type_ensure
Ensures that the indicated type has been registered with the
type system, and its _class_init() method has been run.
In theory, simply calling the type's _get_type() method (or using
the corresponding macro) is supposed take care of this. However,
_get_type() methods are often marked G_GNUC_CONST for performance
reasons, even though this is technically incorrect (since
G_GNUC_CONST requires that the function not have side effects,
which _get_type() methods do on the first call). As a result, if
you write a bare call to a _get_type() macro, it may get optimized
out by the compiler. Using g_type_ensure() guarantees that the
type's _get_type() method is called.
method g_type_ensure ( )
[[g_] type_] get_type_registration_serial
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.
Returns: An unsigned int, representing the state of type registrations
method g_type_get_type_registration_serial ( --> UInt )
[[g_] type_] get_plugin
Returns the GTypePlugin structure for type.
Returns: (transfer none): the corresponding plugin
if type is a dynamic type, Any otherwise
method g_type_get_plugin ( --> int32 )
[[g_] type_] interface_get_plugin
Returns the GTypePlugin structure for the dynamic interface
interface_type which has been added to instance_type, or Any
if interface_type has not been added to instance_type or does
not have a GTypePlugin structure. See g_type_add_interface_dynamic().
Returns: (transfer none): the GTypePlugin for the dynamic interface interface_type of instance_type
method g_type_interface_get_plugin ( int32 $interface_type --> int32 )
int32 $interface_type; GType of an interface type
[[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 next available fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs
method g_type_fundamental_next ( --> int32 )
[g_] type_fundamental
Internal function, used to extract the fundamental type ID portion.
Use G_TYPE_FUNDAMENTAL() instead.
Returns: fundamental type ID
method g_type_fundamental ( --> int32 )
[[g_] type_] create_instance
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.
The extended members of the returned instance are guaranteed to be filled with zeros.
Note: Do not use this function, unless you're implementing a
fundamental type. Also language bindings should not use this
function, but g_object_new() instead.
Returns: an allocated and initialized instance, subject to further treatment by the fundamental type implementation
method g_type_create_instance ( --> int32 )
[[g_] type_] free_instance
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.
method g_type_free_instance ( int32 $instance )
int32 $instance; an instance of a type
[[g_] type_] add_class_cache_func
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 1. 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.
method g_type_add_class_cache_func ( Pointer $cache_data, int32 $cache_func )
Pointer $cache_data; data to be passed to cache_func
int32 $cache_func; a GTypeClassCacheFunc
[[g_] type_] remove_class_cache_func
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.
method g_type_remove_class_cache_func ( Pointer $cache_data, int32 $cache_func )
Pointer $cache_data; data that was given when adding cache_func
int32 $cache_func; a GTypeClassCacheFunc
[[g_] type_] class_unref_uncached
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.
method g_type_class_unref_uncached ( Pointer $g_class )
Pointer $g_class; (type GObject.TypeClass): a N-GTypeClass structure to unref
[[g_] type_] add_interface_check
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).
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.
method g_type_add_interface_check ( Pointer $check_data, int32 $check_func )
Pointer $check_data; data to pass to check_func
int32 $check_func; function to be called after each interface is initialized
[[g_] type_] remove_interface_check
Removes an interface check function added with
g_type_add_interface_check().
method g_type_remove_interface_check ( Pointer $check_data, int32 $check_func )
Pointer $check_data; callback data passed to
g_type_add_interface_check()int32 $check_func; callback function passed to
g_type_add_interface_check()
[[g_] type_] value_table_peek
Returns the location of the GTypeValueTable associated with type.
Note that this function should only be used from source code that implements or has internal knowledge of the implementation of type.
Returns: location of the GTypeValueTable associated with type or
Any if there is no GTypeValueTable associated with type
method g_type_value_table_peek ( --> int32 )
[[g_] type_] check_instance
Private helper function to aid implementation of the
G_TYPE_CHECK_INSTANCE() macro.
Returns: 1 if instance is valid, 0 otherwise
method g_type_check_instance ( N-GTypeInstance $instance --> Int )
N-GTypeInstance $instance; a valid GN-TypeInstance structure
[[g_] type_] class_ref
Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn't exist already.
Returns: (type GObject.TypeClass) (transfer none): the N-GTypeClass structure for the given type ID
method g_type_class_ref ( --> Pointer )
[[g_] type_] class_peek
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 Any if the class
of the type passed in does not currently exist (hasn't been
referenced before).
Returns: (type GObject.TypeClass) (transfer none): the N-GTypeClass
structure for the given type ID or Any if the class does not
currently exist
method g_type_class_peek ( --> Pointer )
[[g_] type_] class_peek_static
A more efficient version of g_type_class_peek() which works only for
static types.
Returns: (type GObject.TypeClass) (transfer none): the N-GTypeClass
structure for the given type ID or Any if the class does not
currently exist or is dynamically loaded
method g_type_class_peek_static ( --> Pointer )
[[g_] type_] class_unref
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.
method g_type_class_unref ( Pointer $g_class )
Pointer $g_class; (type GObject.TypeClass): a N-GTypeClass structure to unref
[[g_] type_] class_peek_parent
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: g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)))
Returns: (type GObject.TypeClass) (transfer none): the parent class of g_class
method g_type_class_peek_parent ( Pointer $g_class --> Pointer )
Pointer $g_class; (type GObject.TypeClass): the N-GTypeClass structure to retrieve the parent class for
[[g_] type_] interface_peek
Returns the GTypeInterface structure of an interface to which the passed in class conforms.
Returns: (type GObject.TypeInterface) (transfer none): the GTypeInterface
structure of iface_type if implemented by instance_class, Any
otherwise
method g_type_interface_peek ( Pointer $instance_class, int32 $iface_type --> Pointer )
Pointer $instance_class; (type GObject.TypeClass): a N-GTypeClass structure
int32 $iface_type; an interface ID which this class conforms to
[[g_] type_] interface_peek_parent
Returns the corresponding GTypeInterface structure of the parent type of the instance type to which g_iface belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.
Returns: (transfer none) (type GObject.TypeInterface): the
corresponding GTypeInterface structure of the parent type of the
instance type to which g_iface belongs, or Any if the parent
type doesn't conform to the interface
method g_type_interface_peek_parent ( Pointer $g_iface --> Pointer )
Pointer $g_iface; (type GObject.TypeInterface): a GTypeInterface structure
[[g_] type_] default_interface_ref
Increments the reference count for the interface type g_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 base_init and class_init 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.
Returns: (type GObject.TypeInterface) (transfer none): the default
vtable for the interface; call g_type_default_interface_unref()
when you are done using the interface.
method g_type_default_interface_ref ( --> Pointer )
[[g_] type_] default_interface_peek
If the interface type g_type is currently in use, returns its default interface vtable.
Returns: (type GObject.TypeInterface) (transfer none): the default
vtable for the interface, or Any if the type is not currently
in use
method g_type_default_interface_peek ( --> Pointer )
[[g_] type_] default_interface_unref
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.
method g_type_default_interface_unref ( Pointer $g_iface )
Pointer $g_iface; (type GObject.TypeInterface): the default vtable structure for a interface, as returned by
g_type_default_interface_ref()
[g_] type_children
Return a newly allocated and 0-terminated array of type IDs, listing the child types of type.
Returns: (array length=n_children) (transfer full): Newly allocated
and 0-terminated array of child types, free with g_free()
method g_type_children ( UInt $n_children --> int32 )
UInt $n_children; (out) (optional): location to store the length of the returned array, or
Any
[g_] type_interfaces
Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to.
Returns: (array length=n_interfaces) (transfer full): Newly allocated
and 0-terminated array of interface types, free with g_free()
method g_type_interfaces ( UInt $n_interfaces --> int32 )
UInt $n_interfaces; (out) (optional): location to store the length of the returned array, or
Any
[[g_] type_] set_qdata
Attaches arbitrary data to a type.
method g_type_set_qdata ( int32 $quark, Pointer $data )
int32 $quark; a GQuark id to identify the data
Pointer $data; the data
[[g_] type_] get_qdata
Obtains data which has previously been attached to type
with g_type_set_qdata().
Note that this does not take subtyping into account; data
attached to one type with g_type_set_qdata() cannot
be retrieved from a subtype using g_type_get_qdata().
Returns: (transfer none): the data, or Any if no data was found
method g_type_get_qdata ( int32 $quark --> Pointer )
int32 $quark; a GQuark id to identify the data
[[g_] type_] next_base
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.
Returns: immediate child of $root_type and anchestor of $leaf_type
method g_type_next_base ( Int $root_type --> UInt )
int32 $root_type; immediate parent of the returned type