![]() |
![]() |
![]() |
libdexterplugin Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <dexterplugin.h> #define DEXTERPLUGIN_DEFINE_TYPE (TN, t_n, T_P) #define DEXTERPLUGIN_DEFINE_TYPE_WITH_CODE (TN, t_n, T_P, _C_) #define DEXTERPLUGIN_DEFINE_TYPE_EXTENDED (TypeName, type_name, TYPE_PARENT, flags, CODE) #define DEXTERPLUGIN_IMPLEMENT_INTERFACE (TYPE_IFACE, iface_init)
Helper macros for defining plugin-based services. They are similar to the standard GObject
macros found in gtype.h
.
Example of how to use the DEXTERPLUGIN_DEFINE_TYPE_WITH_CODE()
macro to define a plugin
sampler service:
#include <dexterplugin.h> ... /* ------------------------------------------------------------------------------------------------- Define a sampler service type from the required abstract base type DEXTERPLUGIN_TYPE_SAMPLER_BASE, implementing the required interface DEXTERPLUGIN_TYPE_ISAMPLER and initializing that interface in plugin function your_plugin_service_isampler_init(). -------------------------------------------------------------------------------------------------- */ DEXTERPLUGIN_DEFINE_TYPE_WITH_CODE (YourPluginService, your_plugin_service, DEXTERPLUGIN_TYPE_SAMPLER_BASE, DEXTERPLUGIN_IMPLEMENT_INTERFACE (DEXTERPLUGIN_TYPE_ISAMPLER, your_plugin_service_isampler_init)); ...
#define DEXTERPLUGIN_DEFINE_TYPE(TN, t_n, T_P) DEXTERPLUGIN_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
Analog to G_DEFINE_TYPE()
used to define object types for Libdexter plugins.
This macro differs from the standard macro in that it registers a dynamic, module-based type rather than a static type.
|
The name of the new type, in Camel case. |
|
The name of the new type, in lowercase, with words separated by '_'. |
|
The GType of the parent type. |
#define DEXTERPLUGIN_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) DEXTERPLUGIN_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, _C_)
Analog to G_DEFINE_TYPE_WITH_CODE()
used to define object types for Libdexter plugins.
This macro differs from the standard macro in that it registers a dynamic, module-based type rather than a static type.
|
The name of the new type, in Camel case. |
|
The name of the new type, in lowercase, with words separated by '_'. |
|
The GType of the parent type. |
|
Custom code that gets inserted in the *_register_type() function. |
#define DEXTERPLUGIN_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE)
Analog to G_DEFINE_TYPE_EXTENDED()
used to define object types for Libdexter plugins.
This macro differs from the standard macro in that it registers a dynamic, module-based type rather than a static type.
DEXTERPLUGIN_DEFINE_TYPE_WITH_CODE (YourPluginService, your_plugin_service, DEXTERPLUGIN_TYPE_SAMPLER_BASE, DEXTERPLUGIN_IMPLEMENT_INTERFACE (DEXTERPLUGIN_TYPE_ISAMPLER, your_plugin_service_isampler_init));
expands to
static GType your_plugin_service_type = G_TYPE_INVALID; static void your_plugin_service_init (YourPlugin *self); static void your_plugin_service_class_init (YourPluginClass *klass); static gpointer your_plugin_service_parent_class = NULL; static void your_plugin_service_class_intern_init (gpointer klass) { your_plugin_service_parent_class = g_type_class_peek_parent (klass); your_plugin_service_class_init ((YourPluginServiceClass*) klass); } GType your_plugin_serice_get_type (void) { return your_plugin_service_type; } void your_plugin_service_register_type (GTypeModule *module) { GType dexterplugin_define_type_id; static const GTypeInfo dexterplugin_type_info = { sizeof (YourPluginServiceClass), NULL, NULL, (GClassInitFunc) your_plugin_service_class_intern_init, NULL, NULL, sizeof (YourPluginService), 0, (GInstanceInitFunc) your_plugin_service_init, NULL }; dexterplugin_define_type_id = g_type_module_register_type (module, DEXTERPLUGIN_TYPE_SAMPLER_BASE, "YourPluginService", &dexterplugin_type_info, (GTypeFlags) 0); your_plugin_service_type = dexterplugin_define_type_id; { static const GInterfaceInfo dexterplugin_implement_interface_info = { (GInterfaceInitFunc) your_plugin_service_isampler_init }; g_type_module_add_interface (module, dexterplugin_define_type_id, DEXTERPLUGIN_TYPE_ISAMPLER, &dexterplugin_implement_interface_info); } }
|
The name of the new type, in Camel case. |
|
The name of the new type, in lowercase, with words separated by '_'. |
|
The GType of the parent type. |
|
flags for g_type_module_register_type() . |
|
Custom code that gets inserted in the *_register_type() function. |
#define DEXTERPLUGIN_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)
Analog to G_IMPLEMENT_INTERFACE()
used to add an interface to Libdexter plugin types.
This macro differs from the standard macro in that it adds the interface to a dynamic, module-based type rather than a static type.
|
The GType of the interface to add. |
|
The interface init function. |