mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
gst/gstutils.h (GST_BOILERPLATE_WITH_INTERFACE): New ghetto macro, implements an interface and gstimplementsinterface...
Original commit message from CVS: 2005-08-22 Andy Wingo <wingo@pobox.com> * gst/gstutils.h (GST_BOILERPLATE_WITH_INTERFACE): New ghetto macro, implements an interface and gstimplementsinterface for a new type.
This commit is contained in:
parent
7b4a9e4c58
commit
e6d23e0aee
1 changed files with 41 additions and 0 deletions
|
@ -88,6 +88,47 @@ type_as_function ## _get_type (void) \
|
||||||
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
|
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
|
||||||
__GST_DO_NOTHING)
|
__GST_DO_NOTHING)
|
||||||
|
|
||||||
|
/* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
|
||||||
|
* implement GstImplementsInterface for that type
|
||||||
|
*
|
||||||
|
* After this you will need to implement interface_as_function ## _supported
|
||||||
|
* and interface_as_function ## _interface_init
|
||||||
|
*/
|
||||||
|
#define GST_BOILERPLATE_WITH_INTERFACE(type, type_as_function, parent_type, \
|
||||||
|
parent_type_as_macro, interface_type, interface_type_as_macro, \
|
||||||
|
interface_as_function) \
|
||||||
|
\
|
||||||
|
static void interface_as_function ## _interface_init (interface_type ## Class *klass); \
|
||||||
|
static gboolean interface_as_function ## _supported (type *object, GType iface_type); \
|
||||||
|
\
|
||||||
|
static void \
|
||||||
|
type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *klass) \
|
||||||
|
{ \
|
||||||
|
klass->supported = (gpointer)interface_as_function ## _supported; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
static void \
|
||||||
|
type_as_function ## _init_interfaces (GType type) \
|
||||||
|
{ \
|
||||||
|
static const GInterfaceInfo implements_iface_info = { \
|
||||||
|
(GInterfaceInitFunc) type_as_function ## _implements_interface_init, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
}; \
|
||||||
|
static const GInterfaceInfo iface_info = { \
|
||||||
|
(GInterfaceInitFunc) interface_as_function ## _interface_init, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
|
||||||
|
&implements_iface_info); \
|
||||||
|
g_type_add_interface_static (type, interface_type_as_macro, &iface_info); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, \
|
||||||
|
parent_type_as_macro, type_as_function ## _init_interfaces)
|
||||||
|
|
||||||
/* Just call the parent handler. This assumes that there is a variable
|
/* Just call the parent handler. This assumes that there is a variable
|
||||||
* named parent_class that points to the (duh!) parent class. Note that
|
* named parent_class that points to the (duh!) parent class. Note that
|
||||||
* this macro is not to be used with things that return something, use
|
* this macro is not to be used with things that return something, use
|
||||||
|
|
Loading…
Reference in a new issue