TypeInfoProtocol
public protocol TypeInfoProtocol
This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type’s class and its instances.
The initialized structure is passed to the g_type_register_static()
function
(or is copied into the provided GTypeInfo
structure in the
g_type_plugin_complete_type_info()
). The type system will perform a deep
copy of this structure, so its memory does not need to be persistent
across invocation of g_type_register_static()
.
The TypeInfoProtocol
protocol exposes the methods and properties of an underlying GTypeInfo
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see TypeInfo
.
Alternatively, use TypeInfoRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GTypeInfo
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
_ptr
Default implementationTyped pointer to the underlying
GTypeInfo
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GTypeInfo
instance.Declaration
Swift
var _ptr: UnsafeMutablePointer<GTypeInfo>! { get }
-
Required Initialiser for types conforming to
TypeInfoProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
enumCompleteTypeInfo(gEnumType:
Extension methodconstValues: ) This function is meant to be called from the
complete_type_info
function of aGTypePlugin
implementation, as in the following example:(C Language Example):
static void my_enum_complete_type_info (GTypePlugin *plugin, GType g_type, GTypeInfo *info, GTypeValueTable *value_table) { static const GEnumValue values[] = { { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" }, { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" }, { 0, NULL, NULL } }; g_enum_complete_type_info (type, info, values); }
Declaration
Swift
@inlinable func enumCompleteTypeInfo<EnumValueT>(gEnumType: GType, constValues: EnumValueT) where EnumValueT : EnumValueProtocol
-
flagsCompleteTypeInfo(gFlagsType:
Extension methodconstValues: ) This function is meant to be called from the
complete_type_info()
function of aGTypePlugin
implementation, see the example forg_enum_complete_type_info()
above.Declaration
Swift
@inlinable func flagsCompleteTypeInfo<FlagsValueT>(gFlagsType: GType, constValues: FlagsValueT) where FlagsValueT : FlagsValueProtocol
-
typeRegisterFundamental(typeID:
Extension methodtypeName: finfo: flags: ) Registers
type_id
as the predefined identifier andtype_name
as the name of a fundamental type. Iftype_id
is already registered, or a type namedtype_name
is already registered, the behaviour is undefined. The type system uses the information contained in theGTypeInfo
structure pointed to byinfo
and theGTypeFundamentalInfo
structure pointed to byfinfo
to manage the type and its instances. The value offlags
determines additional characteristics of the fundamental type.Declaration
Swift
@inlinable func typeRegisterFundamental<TypeFundamentalInfoT>(typeID: GType, typeName: UnsafePointer<gchar>!, finfo: TypeFundamentalInfoT, flags: TypeFlags) -> GType where TypeFundamentalInfoT : TypeFundamentalInfoProtocol
-
typeRegisterStatic(parentType:
Extension methodtypeName: flags: ) Registers
type_name
as the name of a new static type derived fromparent_type
. The type system uses the information contained in theGTypeInfo
structure pointed to byinfo
to manage the type and its instances (if not abstract). The value offlags
determines the nature (e.g. abstract or not) of the type.Declaration
Swift
@inlinable func typeRegisterStatic(parentType: GType, typeName: UnsafePointer<gchar>!, flags: TypeFlags) -> GType
-
classSize
Extension methodSize of the class structure (required for interface, classed and instantiatable types)
Declaration
Swift
@inlinable var classSize: guint16 { get set }
-
baseInit
Extension methodLocation of the base initialization function (optional)
Declaration
Swift
@inlinable var baseInit: GBaseInitFunc! { get set }
-
baseFinalize
Extension methodLocation of the base finalization function (optional)
Declaration
Swift
@inlinable var baseFinalize: GBaseFinalizeFunc! { get set }
-
classInit
Extension methodLocation of the class initialization function for classed and instantiatable types. Location of the default vtable inititalization function for interface types. (optional) This function is used both to fill in virtual functions in the class or default vtable, and to do type-specific setup such as registering signals and object properties.
Declaration
Swift
@inlinable var classInit: GClassInitFunc! { get set }
-
classFinalize
Extension methodLocation of the class finalization function for classed and instantiatable types. Location of the default vtable finalization function for interface types. (optional)
Declaration
Swift
@inlinable var classFinalize: GClassFinalizeFunc! { get set }
-
classData
Extension methodUser-supplied data passed to the class init/finalize functions
Declaration
Swift
@inlinable var classData: gconstpointer? { get set }
-
instanceSize
Extension methodSize of the instance (object) structure (required for instantiatable types only)
Declaration
Swift
@inlinable var instanceSize: guint16 { get set }
-
nPreallocs
Extension methodPrior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the slice allocator now.
Declaration
Swift
@inlinable var nPreallocs: guint16 { get set }
-
instanceInit
Extension methodLocation of the instance initialization function (optional, for instantiatable types only)
Declaration
Swift
@inlinable var instanceInit: GInstanceInitFunc! { get set }
-
valueTable
Extension methodA
GTypeValueTable
function table for generic handling of GValues of this type (usually only useful for fundamental types)Declaration
Swift
@inlinable var valueTable: TypeValueTableRef! { get set }