Type Aliases
The following type aliases are available globally.
-
This is the signature of marshaller functions, required to marshall arrays of parameter values to signal emissions into C language callback invocations.
It is merely an alias to
GClosureMarshal
since theGClosure
mechanism takes over responsibility of actual function invocation for the signal system.Declaration
Swift
public typealias SignalCMarshaller = GSignalCMarshaller
-
A numerical value which represents the unique identifier of a registered type.
Declaration
Swift
public typealias Type_ = GType
-
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 initialization is performed.
See
GClassInitFunc()
for a discussion of the class initialization process.Declaration
Swift
public typealias BaseFinalizeFunc = GBaseFinalizeFunc
-
A callback function used by the type system to do base initialization of the class structures of derived types.
This function 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 initialization process.Declaration
Swift
public typealias BaseInitFunc = GBaseInitFunc
-
A function to be called to transform
from_value
toto_value
.If this is the
transform_to
function of a binding, thenfrom_value
is thesource_property
on thesource
object, andto_value
is thetarget_property
on thetarget
object. If this is thetransform_from
function of aG_BINDING_BIDIRECTIONAL
binding, then those roles are reversed.Declaration
Swift
public typealias BindingTransformFunc = GBindingTransformFunc
-
This function is provided by the user and should produce a copy of the passed in boxed structure.
Declaration
Swift
public typealias BoxedCopyFunc = GBoxedCopyFunc
-
This function is provided by the user and should free the boxed structure passed.
Declaration
Swift
public typealias BoxedFreeFunc = GBoxedFreeFunc
-
The type used for callback functions in structure definitions and function signatures.
This doesn’t mean that all callback functions must take no parameters and return void. The required signature of a callback function is determined by the context in which is used (e.g. the signal to which it is connected).
Use
G_CALLBACK()
to cast the callback function to aGCallback
.Declaration
Swift
public typealias Callback = GCallback
-
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()
andGBaseFinalizeFunc()
.Also, specification of a
GClassFinalizeFunc()
in theGTypeInfo
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).Declaration
Swift
public typealias ClassFinalizeFunc = GClassFinalizeFunc
-
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:
- Copying common members from the parent class over to the derived class structure.
- Zero initialization of the remaining members not copied over from the parent class.
- Invocation of the
GBaseInitFunc()
initializers of all parent types and the class’ type. - Invocation of the class’
GClassInitFunc()
initializer.
Since derived classes are partially initialized through a memory copy of the parent class, the general rule is that
GBaseInitFunc()
andGBaseFinalizeFunc()
should take care of necessary reinitialization and release of those class members that were introduced by the type that specified theseGBaseInitFunc()
/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 aGBaseInitFunc()
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:
(C Language Example):
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 itsGClassInitFunc()
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 callingtype_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 theGClassInitFunc()
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.Declaration
Swift
public typealias ClassInitFunc = GClassInitFunc
-
The type used for marshaller functions.
Declaration
Swift
public typealias ClosureMarshal = GClosureMarshal
-
The type used for the various notification callbacks which can be registered on closures.
Declaration
Swift
public typealias ClosureNotify = GClosureNotify
-
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.
The extended members of
instance
are guaranteed to have been filled with zeros before this function is called.Declaration
Swift
public typealias InstanceInitFunc = GInstanceInitFunc
-
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.Declaration
Swift
public typealias InterfaceFinalizeFunc = GInterfaceFinalizeFunc
-
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.
The members of
iface_data
are guaranteed to have been filled with zeros before this function is called.Declaration
Swift
public typealias InterfaceInitFunc = GInterfaceInitFunc
-
The type of the
finalize
function ofGObjectClass
.Declaration
Swift
public typealias ObjectFinalizeFunc = GObjectFinalizeFunc
-
The type of the
get_property
function ofGObjectClass
.Declaration
Swift
public typealias ObjectGetPropertyFunc = GObjectGetPropertyFunc
-
The type of the
set_property
function ofGObjectClass
.Declaration
Swift
public typealias ObjectSetPropertyFunc = GObjectSetPropertyFunc
-
The signal accumulator is a special callback function that can be used to collect return values of the various callbacks that are called during a signal emission.
The signal accumulator is specified at signal creation time, if it is left
nil
, no accumulation of callback return values is performed. The return value of signal emissions is then the value returned by the last callback.Declaration
Swift
public typealias SignalAccumulator = GSignalAccumulator
-
A simple function pointer to get invoked when the signal is emitted.
Emission hooks allow you to tie a hook to the signal type, so that it will trap all emissions of that signal, from any object.
You may not attach these to signals created with the
G_SIGNAL_NO_HOOKS
flag.Declaration
Swift
public typealias SignalEmissionHook = GSignalEmissionHook
-
A callback function used for notification when the state of a toggle reference changes.
See also:
g_object_add_toggle_ref()
Declaration
Swift
public typealias ToggleNotify = GToggleNotify
-
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 callg_type_class_unref()
from aGTypeClassCacheFunc
function to prevent infinite recursion, useg_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.Declaration
Swift
public typealias TypeClassCacheFunc = GTypeClassCacheFunc
-
A callback called after an interface vtable is initialized.
See
g_type_add_interface_check()
.Declaration
Swift
public typealias TypeInterfaceCheckFunc = GTypeInterfaceCheckFunc
-
The type of the
complete_interface_info
function ofGTypePluginClass
.Declaration
Swift
public typealias TypePluginCompleteInterfaceInfo = GTypePluginCompleteInterfaceInfo
-
The type of the
complete_type_info
function ofGTypePluginClass
.Declaration
Swift
public typealias TypePluginCompleteTypeInfo = GTypePluginCompleteTypeInfo
-
The type of the
unuse_plugin
function ofGTypePluginClass
.Declaration
Swift
public typealias TypePluginUnuse = GTypePluginUnuse
-
The type of the
use_plugin
function ofGTypePluginClass
, which gets called to increase the use count ofplugin
.Declaration
Swift
public typealias TypePluginUse = GTypePluginUse
-
The type of value transformation functions which can be registered with
g_value_register_transform_func()
.dest_value
will be initialized to the correct destination type.Declaration
Swift
public typealias ValueTransform = GValueTransform
-
A
GWeakNotify
function can be added to an object as a callback that gets triggered when the object is finalized.Since the object is already being disposed when the
GWeakNotify
is called, there’s not much you could do with the object, apart from e.g. using its address as hash-index or the like.Declaration
Swift
public typealias WeakNotify = GWeakNotify
-
Union of primitive glib values
Declaration
Swift
public typealias GObjectTypeValueUnion = GObjectCHelpers.GObjectTypeValueUnion
-
A Void closure to use as a signal handler, that takes no parameters.
Declaration
Swift
public typealias SignalHandler = () -> ()
-
A conversion closure transforming the first value into the second This closure needs to return true if successful, or false otherwise
-
Internal type for SignalHandler closure holder
Declaration
Swift
public typealias SignalHandlerClosureHolder = ClosureHolder<Void, Void>
-
Internal type for a binding closure holder
Declaration
Swift
public typealias BindingClosureHolder = BindingHolder<ValueRef, ValueRef>