TypeInterface#
- class TypeInterface(*args, **kwargs)#
An opaque structure used as the base of all interface types.
Methods#
- class TypeInterface
- add_prerequisite(interface_type: type, prerequisite_type: type) None #
Adds
prerequisite_type
to the list of prerequisites ofinterface_type
. This means that any type implementinginterface_type
must also implementprerequisite_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.- Parameters:
interface_type –
Type
value of an interface typeprerequisite_type –
Type
value of an interface or instantiatable type
- get_plugin(instance_type: type, interface_type: type) TypePlugin #
Returns the
TypePlugin
structure for the dynamic interfaceinterface_type
which has been added toinstance_type
, orNone
ifinterface_type
has not been added toinstance_type
or does not have aTypePlugin
structure. Seetype_add_interface_dynamic()
.- Parameters:
instance_type –
Type
of an instantiatable typeinterface_type –
Type
of an interface type
- instantiatable_prerequisite(interface_type: type) type #
Returns the most specific instantiatable prerequisite of an interface type. If the interface type has no instantiatable prerequisite,
Invalid
is returned.See
add_prerequisite()
for more information about prerequisites.Added in version 2.68.
- Parameters:
interface_type – an interface type
- peek(instance_class: TypeClass, iface_type: type) TypeInterface #
Returns the
TypeInterface
structure of an interface to which the passed in class conforms.- Parameters:
instance_class – a
TypeClass
structureiface_type – an interface ID which this class conforms to
- peek_parent() TypeInterface #
Returns the corresponding
TypeInterface
structure of the parent type of the instance type to whichg_iface
belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.