Type
Object Hierarchy:
GLib.Type
GLib.Type
GLib.Type
ulong
ulong
ulong->GLib.Type
Description:
[ CCode ( get_value_function = "g_value_get_gtype" , marshaller_type_name = "GTYPE" , set_value_function = "g_value_set_gtype" , type_id = "G_TYPE_GTYPE" ) ] [ GIR ( fullname = "GType" ) ]public struct Type : ulong
A numerical value which represents the unique identifier of a registered type.
Example: Introspection (GType):
public interface Interface : Object {}public abstract class AbstractGObject : Object, Interface {}public static int main (string [] args) { // Output: // ``AbstractGObject`` // `` is-obj: true`` // `` is-abstr: true`` // `` is-classed: true`` // `` is-derivable: true`` // `` is-derived: true`` // `` is-fund: false`` // `` is-inst: true`` // `` is-iface: false`` // `` is-enum: false`` // `` is-flags: true`` Type type = typeof (AbstractGObject); print (" %s \n " , type.name ()); print (" is-obj: %s \n " , type.is_object ().to_string ()); print (" is-abstr: %s \n " , type.is_abstract ().to_string ()); print (" is-classed: %s \n " , type.is_classed ().to_string ()); print (" is-derivable: %s \n " , type.is_derivable ().to_string ()); print (" is-derived: %s \n " , type.is_derived ().to_string ()); print (" is-fund: %s \n " , type.is_fundamental ().to_string ()); print (" is-inst: %s \n " , type.is_instantiatable ().to_string ()); print (" is-iface: %s \n " , type.is_interface ().to_string ()); print (" is-enum: %s \n " , type.is_enum ().to_string ()); print (" is-flags: %s \n " , type.is_object ().to_string ()); // Output: // `` Children:`` print (" Children: \n " ); foreach (unowned Type ch in type.children ()) { print (" - %s \n " , ch.name ()); } // `` Interfaces:`` // `` - Interface`` print (" Interfaces: \n " ); foreach (unowned Type ch in type.interfaces ()) { print (" - %s \n " , ch.name ()); } // Output: // `` Parents:`` // `` - GObject`` print (" Parents: \n " ); for (Type p = type.parent (); p != 0 ; p = p.parent ()) { print (" - %s \n " , p.name ()); } return 0 ; }
valac --pkg gobject-2.0 GLib.Type.vala
Content:
Constants:
Static methods:
public static Type from_instance (void * instance)
public static Type from_name (string name)
Look up 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).
public static uint get_type_registration_serial ()
Returns an opaque serial number that represents the state of the set
of registered types.
Methods:
public void add_class_private (size_t private_size)
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.
public Type [] children ()
Return a newly allocated and 0-terminated array of type IDs, listing
the child types of type
.
public unowned TypeClass ? class_peek ()
This function is essentially the same as
class_ref , except that the classes reference count isn't incremented.
public unowned TypeClass ? class_peek_static ()
A more efficient version of
class_peek which works only for static types.
public TypeClass class_ref ()
Increments the reference count of the class structure belonging to
type
.
public unowned TypeClass ? default_interface_peek ()
If the interface type g_type
is currently in use, returns
its default interface vtable.
public TypeInterface default_interface_ref ()
Increments the reference count for the interface type g_type
, and returns the default interface vtable for the type.
public uint depth ()
Returns the length of the ancestry of the passed in type.
public void ensure ()
Ensures that the indicated type
has been registered with
the type system, and its _class_init
method has been run.
public string enum_to_string (int value)
Pretty-prints value
in the form of the enum’s name.
public string flags_to_string (uint value)
Pretty-prints value
in the form of the flag names
separated by ` | ` and sorted.
public int 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).
public void * get_qdata (Quark quark)
Obtains data which has previously been attached to type
with set_qdata .
public void interface_add_prerequisite (Type prerequisite_type)
Adds prerequisite_type
to the list of prerequisites of
interface_type
.
public unowned TypePlugin interface_get_plugin (Type interface_type)
Returns the
TypePlugin structure for the dynamic interface interface_type
which has been added to instance_type
,
or null if interface_type
has not been added to instance_type
or does not
have a TypePlugin structure.
public Type interface_instantiatable_prerequisite ()
Returns the most specific instantiatable prerequisite of an interface
type.
public Type [] interface_prerequisites ()
Returns the prerequisites of an interfaces type.
public Type [] interfaces ()
Return a newly allocated and 0-terminated array of type IDs, listing
the interface types that type
conforms to.
public bool is_a (Type is_a_type)
If is_a_type
is a derivable type, check whether
type
is a descendant of is_a_type
.
public bool is_abstract ()
public bool is_classed ()
public bool is_deep_derivable ()
public bool is_derivable ()
public bool is_derived ()
public bool is_enum ()
public bool is_final ()
public bool is_flags ()
public bool is_fundamental ()
public bool is_instantiatable ()
public bool is_interface ()
public bool is_object ()
public bool is_value_type ()
public unowned string name ()
Get the unique name that is assigned to a type ID.
public Type next_base (Type root_type)
Given a leaf_type
and a root_type
which is
contained in its ancestry, return the type that root_type
is the immediate parent of.
public Type parent ()
Return the direct parent type of the passed in type.
public Quark qname ()
Get the corresponding quark of the type IDs name.
public void query (out TypeQuery query)
Queries the type system for information about a specific type.
public void set_qdata (Quark quark, void * data)
Attaches arbitrary data to a type.
Inherited Members:
All known members inherited from struct ulong
MAX
MIN
clamp
from_big_endian
from_little_endian
max
min
parse
to_big_endian
to_little_endian
to_string
try_parse