TypeInfoProtocol

public protocol TypeInfoProtocol

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.

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().

  • ptr

    Untyped pointer to the underlying GTypeInfo instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer { get }
  • _ptr Default implementation

    Typed 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 }

TypeInfo Record: TypeInfoProtocol extension (methods and fields)

  • This function is meant to be called from the complete_type_info function of a GTypePlugin 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

    func enumCompleteTypeInfo(gEnumType g_enum_type: GType, constValues const_values: EnumValueProtocol)
  • This function is meant to be called from the complete_type_info() function of a GTypePlugin implementation, see the example for g_enum_complete_type_info() above.

    Declaration

    Swift

    func flagsCompleteTypeInfo(gFlagsType g_flags_type: GType, constValues const_values: FlagsValueProtocol)
  • 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.

    Declaration

    Swift

    func typeRegisterFundamental(typeID type_id: GType, typeName type_name: UnsafePointer<gchar>, finfo: TypeFundamentalInfoProtocol, flags: TypeFlags) -> GType
  • 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.

    Declaration

    Swift

    func typeRegisterStatic(parentType parent_type: GType, typeName type_name: UnsafePointer<gchar>, flags: TypeFlags) -> GType
  • classSize Extension method

    Size of the class structure (required for interface, classed and instantiatable types)

    Declaration

    Swift

    var classSize: UInt16 { get set }
  • baseInit Extension method

    Location of the base initialization function (optional)

    Declaration

    Swift

    var baseInit: GBaseInitFunc { get set }
  • baseFinalize Extension method

    Location of the base finalization function (optional)

    Declaration

    Swift

    var baseFinalize: GBaseFinalizeFunc { get set }
  • classInit Extension method

    Location 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

    var classInit: GClassInitFunc { get set }
  • classFinalize Extension method

    Location of the class finalization function for classed and instantiatable types. Location of the default vtable finalization function for interface types. (optional)

    Declaration

    Swift

    var classFinalize: GClassFinalizeFunc { get set }
  • classData Extension method

    User-supplied data passed to the class init/finalize functions

    Declaration

    Swift

    var classData: gconstpointer { get set }
  • instanceSize Extension method

    Size of the instance (object) structure (required for instantiatable types only)

    Declaration

    Swift

    var instanceSize: UInt16 { get set }
  • nPreallocs Extension method

    Prior 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

    var nPreallocs: UInt16 { get set }
  • instanceInit Extension method

    Location of the instance initialization function (optional, for instantiatable types only)

    Declaration

    Swift

    var instanceInit: GInstanceInitFunc { get set }
  • valueTable Extension method

    A GTypeValueTable function table for generic handling of GValues of this type (usually only useful for fundamental types)

    Declaration

    Swift

    var valueTable: UnsafePointer<GTypeValueTable> { get set }