XmmsClient
Enumerations | Functions
interface_entity.h File Reference

Enumerations

enum  xmmsc_sc_interface_entity_type_t { XMMSC_SC_INTERFACE_ENTITY_TYPE_NAMESPACE, XMMSC_SC_INTERFACE_ENTITY_TYPE_METHOD, XMMSC_SC_INTERFACE_ENTITY_TYPE_BROADCAST }
 

Functions

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...
 
xmmsc_sc_namespace_txmmsc_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...
 
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_txmmsc_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_txmmsc_sc_interface_entity_broadcast_introspect (xmmsc_sc_interface_entity_t *bcast)
 Introspect into a broadcast interface entity. More...
 
xmmsv_txmmsc_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_txmmsc_sc_interface_entity_method_introspect (xmmsc_sc_interface_entity_t *method)
 Introspect into a method 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...
 
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...
 
xmmsv_txmmsc_sc_interface_entity_namespace_introspect (xmmsc_sc_interface_entity_t *nms)
 Introspect into a namespace interface entity. More...
 

Enumeration Type Documentation

Enumerator
XMMSC_SC_INTERFACE_ENTITY_TYPE_NAMESPACE 
XMMSC_SC_INTERFACE_ENTITY_TYPE_METHOD 
XMMSC_SC_INTERFACE_ENTITY_TYPE_BROADCAST 

Function Documentation

void xmmsc_sc_interface_entity_broadcast_add_id ( xmmsc_sc_interface_entity_t *  bcast,
int  id 
)

Add a message id to a broadcast.

Parameters
bcastThe broadcast interface entity.
idThe 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.

Parameters
bcastThe broadcast interface entity.
Returns
A list of integer message ids.

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.

Parameters
broadcastThe broadcast interface entity.

Referenced by xmmsc_sc_interface_entity_namespace_introspect().

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.

Parameters
ifentThe 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.

Parameters
ifentThe 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.

Parameters
methodThe method interface entity.
pargsThe list of positional arguments.
nargsThe dictionary of named arguments.
Returns
The value returned by the method or an error if the arguments don't match the method's signature.
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.

Parameters
methodThe method interface entity.
Returns
A dictionary describing the method.

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.

Parameters
nmsThe namespace interface entity.
Returns
A dictionary describing the namespace.
xmmsc_sc_interface_entity_t* xmmsc_sc_interface_entity_new_broadcast ( const char *  name,
const char *  docstring 
)

Create a new broadcast interface entity.

Parameters
nameThe name of the interface entity.
docstringThe docstring of the interface entity.
Returns
The new 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.

Parameters
nameThe name of the interface entity. Must not be NULL.
docstringThe docstring of the interface entity.
Returns
The new 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.

Parameters
nameThe name of the interface entity.
docstringThe docstring of the interface entity.
Returns
The new 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.

Parameters
nmsThe namespace.
childThe child interface entity.

Referenced by xmmsc_sc_namespace_add_broadcast(), xmmsc_sc_namespace_add_method(), and xmmsc_sc_namespace_new().

void xmmsc_sc_namespace_destroy ( xmmsc_sc_namespace_t nms)

Destroy a namespace.

Parameters
nmsThe namespace.

Referenced by xmmsc_sc_interface_entity_destroy().

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.

Parameters
rootThe namespace from which to start.
pathA list of strings for each entity along the path.
parentA return location to store the parent namespace, or NULL.
Returns
The interface entity, or NULL if not found.

Referenced by xmmsc_sc_locate_interface_entity(), xmmsc_sc_namespace_get(), and xmmsc_sc_namespace_remove().