XmmsClient
Macros | Functions
xmmsv_service.c File Reference
#include <xmmsc/xmmsv.h>
#include <xmmsc/xmmsc_util.h>
#include <xmmsc/xmmsv_service.h>
#include <xmmsclientpriv/xmmsclient_util.h>

Macros

#define GEN_SC_ARGUMENT_FIELD_GET_FUNC(field, getter, ctype, failval)
 

Functions

xmmsv_txmmsv_sc_argument_new (const char *name, const char *docstring, xmmsv_type_t type, xmmsv_t *default_value)
 Create a new argument for a method. More...
 
 GEN_SC_ARGUMENT_FIELD_GET_FUNC (name, xmmsv_dict_entry_get_string, const char *, NULL)
 Extract the name of an argument. More...
 
 GEN_SC_ARGUMENT_FIELD_GET_FUNC (docstring, xmmsv_dict_entry_get_string, const char *, NULL)
 Extract the docstring of an argument. More...
 
 GEN_SC_ARGUMENT_FIELD_GET_FUNC (type, xmmsv_dict_entry_get_int, int64_t, XMMSV_TYPE_ERROR)
 Extract the type of an argument. More...
 
 GEN_SC_ARGUMENT_FIELD_GET_FUNC (default_value, xmmsv_dict_get, xmmsv_t *, NULL)
 Extract the default value of an argument. More...
 

Macro Definition Documentation

#define GEN_SC_ARGUMENT_FIELD_GET_FUNC (   field,
  getter,
  ctype,
  failval 
)
Value:
ctype \
xmmsv_sc_argument_get_##field (xmmsv_t *arg) \
{ \
ctype ret; \
if (!getter (arg, #field, &ret)) \
return failval; \
return ret; \
}

Function Documentation

GEN_SC_ARGUMENT_FIELD_GET_FUNC ( name  ,
xmmsv_dict_entry_get_string  ,
const char *  ,
NULL   
)

Extract the name of an argument.

Parameters
argThe argument.
Returns
The name upon success, NULL upon failure.
GEN_SC_ARGUMENT_FIELD_GET_FUNC ( docstring  ,
xmmsv_dict_entry_get_string  ,
const char *  ,
NULL   
)

Extract the docstring of an argument.

Parameters
argThe argument.
Returns
The docstring upon success, NULL upon failure.
GEN_SC_ARGUMENT_FIELD_GET_FUNC ( type  ,
xmmsv_dict_entry_get_int  ,
int64_t  ,
XMMSV_TYPE_ERROR   
)

Extract the type of an argument.

Parameters
argThe argument.
Returns
The type, or XMMSV_TYPE_ERROR upon error.
GEN_SC_ARGUMENT_FIELD_GET_FUNC ( default_value  ,
xmmsv_dict_get  ,
xmmsv_t ,
NULL   
)

Extract the default value of an argument.

Parameters
argThe argument.
Returns
The default value or NULL upon error.
xmmsv_t* xmmsv_sc_argument_new ( const char *  name,
const char *  docstring,
xmmsv_type_t  type,
xmmsv_t default_value 
)

Create a new argument for a method.

Parameters
nameThe name of the argument. Must not be NULL.
docstringThe docstring of the argument.
typeThe expected type of the argument. Use XMMSV_TYPE_NONE to accept any type. XMMSV_TYPE_ERROR is reserved and should not be used.
default_valueValue to set this argument to if it's missing in the method call. Implies that the argument is optional. If NULL, the argument is not optional.