XmmsClient
|
#include "xmmsclient/xmmsclient.h"
#include "xmmsclientpriv/xmmsclient.h"
#include "xmmsclientpriv/xmmsclient_util.h"
#include "interface_entity.h"
Typedefs | |
typedef struct xmmsc_sc_method_desc_St | xmmsc_sc_method_desc_t |
typedef struct xmmsc_sc_broadcast_desc_St | xmmsc_sc_broadcast_desc_t |
Functions | |
void | xmmsc_sc_interface_entity_destroy (xmmsc_sc_interface_entity_t *ifent) |
Destroy an interface entity. More... | |
xmmsc_sc_interface_entity_t * | xmmsc_sc_interface_entity_new_method (const char *name, const char *docstring, xmmsc_sc_method_t method, xmmsv_t *positional_args, xmmsv_t *named_args, bool va_positional, bool va_named, void *userdata) |
Create a new method interface entity. More... | |
xmmsc_sc_interface_entity_t * | xmmsc_sc_interface_entity_new_broadcast (const char *name, const char *docstring) |
Create a new broadcast interface entity. More... | |
xmmsc_sc_interface_entity_t * | xmmsc_sc_interface_entity_new_namespace (const char *name, const char *docstring) |
Create a new namespace interface entity. More... | |
void | xmmsc_sc_namespace_remove (xmmsc_sc_namespace_t *nms, xmmsv_t *path) |
Remove a symbol from a namespace. More... | |
xmmsc_sc_namespace_t * | xmmsc_sc_interface_entity_get_namespace (xmmsc_sc_interface_entity_t *ifent) |
Get the namespace from an interface entity. More... | |
xmmsc_sc_interface_entity_type_t | xmmsc_sc_interface_entity_get_type (xmmsc_sc_interface_entity_t *ifent) |
Get the type of an interface entity. More... | |
xmmsv_t * | xmmsc_sc_interface_entity_method_call (xmmsc_sc_interface_entity_t *method, xmmsv_t *pargs, xmmsv_t *nargs) |
Call a method represented by an interface entity. More... | |
xmmsv_t * | xmmsc_sc_interface_entity_method_introspect (xmmsc_sc_interface_entity_t *method) |
Introspect into a method interface entity. More... | |
void | xmmsc_sc_interface_entity_broadcast_add_id (xmmsc_sc_interface_entity_t *bcast, int id) |
Add a message id to a broadcast. More... | |
xmmsv_t * | xmmsc_sc_interface_entity_broadcast_get_ids (xmmsc_sc_interface_entity_t *bcast) |
Borrow a reference to the list of message ids in a broadcast. More... | |
xmmsv_t * | xmmsc_sc_interface_entity_broadcast_introspect (xmmsc_sc_interface_entity_t *bcast) |
Introspect into a broadcast interface entity. More... | |
xmmsv_t * | xmmsc_sc_interface_entity_namespace_introspect (xmmsc_sc_interface_entity_t *nms) |
Introspect into a namespace interface entity. More... | |
void | xmmsc_sc_namespace_destroy (xmmsc_sc_namespace_t *nms) |
Destroy a namespace. More... | |
bool | xmmsc_sc_namespace_add_child (xmmsc_sc_namespace_t *nms, xmmsc_sc_interface_entity_t *child) |
Add a child to a namespace. More... | |
bool | xmmsc_sc_namespace_add_constant (xmmsc_sc_namespace_t *nms, const char *key, xmmsv_t *value) |
Add a constant key, value pair to a namespace. More... | |
void | xmmsc_sc_namespace_remove_constant (xmmsc_sc_namespace_t *nms, const char *key) |
Remove a symbol from a namespace. More... | |
xmmsc_sc_interface_entity_t * | xmmsc_sc_namespace_resolve_path (xmmsc_sc_namespace_t *root, xmmsv_t *path, xmmsc_sc_namespace_t **parent) |
Resolve a path into an interface entity. More... | |
typedef struct xmmsc_sc_broadcast_desc_St xmmsc_sc_broadcast_desc_t |
typedef struct xmmsc_sc_method_desc_St xmmsc_sc_method_desc_t |
void xmmsc_sc_interface_entity_broadcast_add_id | ( | xmmsc_sc_interface_entity_t * | bcast, |
int | id | ||
) |
Add a message id to a broadcast.
bcast | The broadcast interface entity. |
id | The message id. |
xmmsv_t* xmmsc_sc_interface_entity_broadcast_get_ids | ( | xmmsc_sc_interface_entity_t * | bcast | ) |
Borrow a reference to the list of message ids in a broadcast.
bcast | The broadcast interface entity. |
Referenced by xmmsc_sc_broadcast_emit().
xmmsv_t* xmmsc_sc_interface_entity_broadcast_introspect | ( | xmmsc_sc_interface_entity_t * | bcast | ) |
Introspect into a broadcast interface entity.
A broadcast description dictionary has the form:
"name" : the broadcast's name.
"docstring" : the broadcast's docstring.
broadcast | The broadcast interface entity. |
Referenced by xmmsc_sc_interface_entity_namespace_introspect().
void xmmsc_sc_interface_entity_destroy | ( | xmmsc_sc_interface_entity_t * | ifent | ) |
Destroy an interface entity.
ifent | The interface entity. |
Referenced by xmmsc_sc_interface_entity_new_broadcast(), xmmsc_sc_interface_entity_new_method(), xmmsc_sc_interface_entity_new_namespace(), xmmsc_sc_namespace_add_broadcast(), xmmsc_sc_namespace_add_method(), xmmsc_sc_namespace_destroy(), xmmsc_sc_namespace_new(), and xmmsc_sc_namespace_remove().
xmmsc_sc_namespace_t* xmmsc_sc_interface_entity_get_namespace | ( | xmmsc_sc_interface_entity_t * | ifent | ) |
Get the namespace from an interface entity.
The namespace still belongs to the interface entity and should not be destroyed by the caller.
ifent | The interface entity. |
Referenced by xmmsc_sc_create_root_namespace(), xmmsc_sc_init(), xmmsc_sc_locate_interface_entity(), xmmsc_sc_namespace_get(), xmmsc_sc_namespace_lookup(), xmmsc_sc_namespace_new(), and xmmsc_sc_namespace_root().
xmmsc_sc_interface_entity_type_t xmmsc_sc_interface_entity_get_type | ( | xmmsc_sc_interface_entity_t * | ifent | ) |
Get the type of an interface entity.
ifent | The interface entity. |
Referenced by xmmsc_sc_broadcast_emit(), and xmmsc_sc_interface_entity_namespace_introspect().
xmmsv_t* xmmsc_sc_interface_entity_method_call | ( | xmmsc_sc_interface_entity_t * | method, |
xmmsv_t * | pargs, | ||
xmmsv_t * | nargs | ||
) |
Call a method represented by an interface entity.
method | The method interface entity. |
pargs | The list of positional arguments. |
nargs | The dictionary of named arguments. |
xmmsv_t* xmmsc_sc_interface_entity_method_introspect | ( | xmmsc_sc_interface_entity_t * | method | ) |
Introspect into a method interface entity.
The method description is a dictionary of the form:
"name" : the method's name.
"docstring" : the method's docstring.
"positional-arguments" : a list of positional arguments.
"named-arguments" : a list of named arguments.
"va-positional" : whether or not this method accepts a variable number of positional-arguments.
"va-named" : whether or not this method accepts a variable number of named arguments.
method | The method interface entity. |
Referenced by xmmsc_sc_interface_entity_namespace_introspect().
xmmsv_t* xmmsc_sc_interface_entity_namespace_introspect | ( | xmmsc_sc_interface_entity_t * | nms | ) |
Introspect into a namespace interface entity.
The namespace description is a dictionary of the form:
"name" : the namespace's name.
"docstring" : the namespace's docstring.
"constants" : a dictionary of constants.
"namespaces" : a list of names of subnamespaces.
"methods" : a list of descriptions of the methods in the namespace.
"broadcasts" : a list of descriptions of the broadcasts in the namespace.
nms | The namespace interface entity. |
xmmsc_sc_interface_entity_t* xmmsc_sc_interface_entity_new_broadcast | ( | const char * | name, |
const char * | docstring | ||
) |
Create a new broadcast interface entity.
name | The name of the interface entity. |
docstring | The docstring of the interface entity. |
Referenced by xmmsc_sc_namespace_add_broadcast().
xmmsc_sc_interface_entity_t* xmmsc_sc_interface_entity_new_method | ( | const char * | name, |
const char * | docstring, | ||
xmmsc_sc_method_t | method, | ||
xmmsv_t * | positional_args, | ||
xmmsv_t * | named_args, | ||
bool | va_positional, | ||
bool | va_named, | ||
void * | userdata | ||
) |
Create a new method interface entity.
name | The name of the interface entity. Must not be NULL. |
docstring | The docstring of the interface entity. |
Referenced by xmmsc_sc_namespace_add_method().
xmmsc_sc_interface_entity_t* xmmsc_sc_interface_entity_new_namespace | ( | const char * | name, |
const char * | docstring | ||
) |
Create a new namespace interface entity.
name | The name of the interface entity. |
docstring | The docstring of the interface entity. |
Referenced by xmmsc_sc_create_root_namespace(), and xmmsc_sc_namespace_new().
bool xmmsc_sc_namespace_add_child | ( | xmmsc_sc_namespace_t * | nms, |
xmmsc_sc_interface_entity_t * | child | ||
) |
Add a child to a namespace.
The child's name must not already be registered in the namespace.
nms | The namespace. |
child | The child interface entity. |
Referenced by xmmsc_sc_namespace_add_broadcast(), xmmsc_sc_namespace_add_method(), and xmmsc_sc_namespace_new().
bool xmmsc_sc_namespace_add_constant | ( | xmmsc_sc_namespace_t * | nms, |
const char * | key, | ||
xmmsv_t * | value | ||
) |
Add a constant key, value pair to a namespace.
nms | The namespace. |
key | The key to the constant. |
value | The value of the constant. |
Referenced by xmmsc_sc_create_root_namespace().
void xmmsc_sc_namespace_destroy | ( | xmmsc_sc_namespace_t * | nms | ) |
Destroy a namespace.
nms | The namespace. |
Referenced by xmmsc_sc_interface_entity_destroy().
void xmmsc_sc_namespace_remove | ( | xmmsc_sc_namespace_t * | nms, |
xmmsv_t * | path | ||
) |
Remove a symbol from a namespace.
The relative path can point to a subnamespace, a method or a broadcast.
nms | The parent namespace. |
path | The relative path of the symbol. |
void xmmsc_sc_namespace_remove_constant | ( | xmmsc_sc_namespace_t * | nms, |
const char * | key | ||
) |
Remove a symbol from a namespace.
The relative path can point to a subnamespace, a method or a broadcast.
nms | The parent namespace. |
path | The relative path of the symbol. |
xmmsc_sc_interface_entity_t* xmmsc_sc_namespace_resolve_path | ( | xmmsc_sc_namespace_t * | root, |
xmmsv_t * | path, | ||
xmmsc_sc_namespace_t ** | parent | ||
) |
Resolve a path into an interface entity.
root | The namespace from which to start. |
path | A list of strings for each entity along the path. |
parent | A return location to store the parent namespace, or NULL. |
Referenced by xmmsc_sc_locate_interface_entity(), xmmsc_sc_namespace_get(), and xmmsc_sc_namespace_remove().