Top | ![]() |
![]() |
![]() |
![]() |
void | (*XedMessageTypeForeach) () |
gboolean | xed_message_type_is_supported () |
gchar * | xed_message_type_identifier () |
gboolean | xed_message_type_is_valid_object_path () |
XedMessageType * | xed_message_type_new () |
XedMessageType * | xed_message_type_new_valist () |
void | xed_message_type_set () |
void | xed_message_type_set_valist () |
XedMessageType * | xed_message_type_ref () |
void | xed_message_type_unref () |
XedMessage * | xed_message_type_instantiate_valist () |
XedMessage * | xed_message_type_instantiate () |
const gchar * | xed_message_type_get_object_path () |
const gchar * | xed_message_type_get_method () |
GType | xed_message_type_lookup () |
void | xed_message_type_foreach () |
A message type is a prototype description for a XedMessage used to transmit messages on a XedMessageBus. The message type describes the Object Path, Method and Arguments of the message.
A message type can contain any number of required and optional arguments.
To instantiate a XedMessage from a XedMessageType, use
xed_message_type_instantiate()
.
Registering a new message type on a XedMessageBus with
xed_message_bus_register()
internally creates a new XedMessageType. When
then using xed_message_bus_send()
, an actual instantiation of the
registered type is internally created and send over the bus.
Example 4.
1 2 3 4 5 6 7 8 9 10 11 |
// Defining a new message type XedMessageType *message_type = xed_message_type_new ("/plugins/example", "method", 0, "arg1", G_TYPE_STRING, NULL); // Instantiating an actual message from the type XedMessage *message = xed_message_type_instantiate (message_type, "arg1", "Hello World", NULL); |
void (*XedMessageTypeForeach) (const gchar *key
,GType type
,gboolean required
,gpointer user_data
);
gboolean
xed_message_type_is_supported (GType type
);
Returns if type
is GType supported by the message system.
gchar * xed_message_type_identifier (const gchar *object_path
,const gchar *method
);
Get the string identifier for method
at object_path
.
gboolean
xed_message_type_is_valid_object_path (const gchar *object_path
);
Returns whether object_path
is a valid object path
XedMessageType * xed_message_type_new (const gchar *object_path
,const gchar *method
,guint num_optional
,...
);
Create a new XedMessageType for method
at object_path
. Argument names
and values are supplied by the NULL terminated variable argument list.
The last num_optional
provided arguments are considered optional.
XedMessageType * xed_message_type_new_valist (const gchar *object_path
,const gchar *method
,guint num_optional
,va_list var_args
);
Create a new XedMessageType for method
at object_path
. Argument names
and values are supplied by the NULL terminated variable argument list.
The last num_optional
provided arguments are considered optional.
void xed_message_type_set (XedMessageType *message_type
,guint num_optional
,...
);
Sets argument names/types supplied by the NULL terminated variable
argument list. The last num_optional
provided arguments are considered
optional.
message_type |
the XedMessageType |
|
num_optional |
number of optional arguments |
|
... |
key/gtype pair variable argument list |
void xed_message_type_set_valist (XedMessageType *message_type
,guint num_optional
,va_list var_args
);
Sets argument names/types supplied by the NULL terminated variable
argument list var_args
. The last num_optional
provided arguments are
considered optional.
message_type |
the XedMessageType |
|
num_optional |
number of optional arguments |
|
var_args |
key/gtype pair variable argument list |
XedMessageType *
xed_message_type_ref (XedMessageType *message_type
);
Increases the reference count on message_type
.
void
xed_message_type_unref (XedMessageType *message_type
);
Decreases the reference count on message_type
. When the reference count
drops to 0, message_type
is destroyed.
XedMessage * xed_message_type_instantiate_valist (XedMessageType *message_type
,va_list va_args
);
Instantiate a new message from the message type with specific values for the message arguments.
XedMessage * xed_message_type_instantiate (XedMessageType *message_type
,...
);
Instantiate a new message from the message type with specific values for the message arguments.
const gchar *
xed_message_type_get_object_path (XedMessageType *message_type
);
Get the message type object path.
const gchar *
xed_message_type_get_method (XedMessageType *message_type
);
Get the message type method.
GType xed_message_type_lookup (XedMessageType *message_type
,const gchar *key
);
Get the argument key GType.
void xed_message_type_foreach (XedMessageType *message_type
,XedMessageTypeForeach func
,gpointer user_data
);
Calls func
for each argument in the message type.
message_type |
the XedMessageType |
|
func |
the callback function. |
[scope call] |
user_data |
user data supplied to the callback function |