SPRpcParams data struct

SPRpcParams data struct — The Container of SPRpcValue(s)

Synopsis

typedef             SPRpcParams;
typedef             SPRpcIter;
SPRpcParams*        sp_rpc_params_new                   (void);
void                sp_rpc_params_ref                   (SPRpcParams *params);
void                sp_rpc_params_unref                 (SPRpcParams *params);
gboolean            sp_rpc_params_has                   (SPRpcParams *params,
                                                         const gchar *name);
SPRpcValue*         sp_rpc_params_get                   (SPRpcParams *params,
                                                         const gchar *name);
void                sp_rpc_params_add                   (SPRpcParams *params,
                                                         const gchar *name,
                                                         SPRpcValue *value);
void                sp_rpc_params_del                   (SPRpcParams *params,
                                                         const gchar *name);
gboolean            sp_rpc_params_is_empty              (SPRpcParams *params);
void                sp_rpc_params_iter_init             (SPRpcParams *params,
                                                         SPRpcIter *iter);
gboolean            sp_rpc_params_iter_next             (SPRpcIter *iter,
                                                         gchar **name,
                                                         SPRpcValue **value);
void                sp_rpc_params_iter_remove           (SPRpcIter *iter);

Description

Functions about SPRpcParams, the container of SPRpcValue(s)

Details

SPRpcParams

typedef struct sp_rpc_params_t SPRpcParams;

The container of SPRpcValues


SPRpcIter

typedef GHashTableIter SPRpcIter;

The iterator of SPRpcParams and SPRpcValue structs.


sp_rpc_params_new ()

SPRpcParams*        sp_rpc_params_new                   (void);

Creates a new SPRpcParams.

Returns :

a new SPRpcParams with a reference count of 1

sp_rpc_params_ref ()

void                sp_rpc_params_ref                   (SPRpcParams *params);

Increases the reference count of a SPRpcParams.

params :

a SPRpcParams

sp_rpc_params_unref ()

void                sp_rpc_params_unref                 (SPRpcParams *params);

Decreases the reference count of a SPRpcParams. When its reference count drops to 0, the SPRpcParams is finalized.

params :

a SPRpcParams

sp_rpc_params_has ()

gboolean            sp_rpc_params_has                   (SPRpcParams *params,
                                                         const gchar *name);

Looks whether the params array has the value name.

params :

a SPRpcParams

name :

the name of the value

Returns :

TRUE if key is a part of the params, FALSE otherwise.

sp_rpc_params_get ()

SPRpcValue*         sp_rpc_params_get                   (SPRpcParams *params,
                                                         const gchar *name);

Looks up a value in a params array.

params :

a SPRpcParams

name :

the name of the value

Returns :

the associated value, or NULL

sp_rpc_params_add ()

void                sp_rpc_params_add                   (SPRpcParams *params,
                                                         const gchar *name,
                                                         SPRpcValue *value);

Inserts into the params array a new value and increases its count references.

params :

a SPRpcParams

name :

the name of the new value

value :

a SPRpcValue

sp_rpc_params_del ()

void                sp_rpc_params_del                   (SPRpcParams *params,
                                                         const gchar *name);

Removes a value from a SPRpcParams and decreases the count reference of this value

params :

a SPRpcParams

name :

the name of the value

sp_rpc_params_is_empty ()

gboolean            sp_rpc_params_is_empty              (SPRpcParams *params);

params :

a SPRpcParams

Returns :

TRUE if the params array is empty.

sp_rpc_params_iter_init ()

void                sp_rpc_params_iter_init             (SPRpcParams *params,
                                                         SPRpcIter *iter);

Initializes a key/value pair iterator and associates it with the a SPRpcParams. Modifying the struct after calling this function invalidates the returned iterator.

gchar *key;
SPRpcValue *value;
SPRpcIter iter;

sp_rpc_params_iter_initt(params, &iter);
while (sp_rpc_params_iter_next(&iter, &key, &value)) 
  {
    /* do something with key and value */
  }

params :

a SPRpcParams

iter :

an unitialized SPRpcIter

sp_rpc_params_iter_next ()

gboolean            sp_rpc_params_iter_next             (SPRpcIter *iter,
                                                         gchar **name,
                                                         SPRpcValue **value);

Advances iter and retrieves the key and/or value that are now pointed to as a result of this advancement. If FALSE is returned, key and value are not set, and the iterator becomes invalid.

iter :

an initialized SPRpcIter

name :

a location for the key, or NULL

value :

the location for the value, or NULL

Returns :

FALSE if the end of struct has been reached

sp_rpc_params_iter_remove ()

void                sp_rpc_params_iter_remove           (SPRpcIter *iter);

Removes the key/value pair currently pointed to by the iterator from its associated SPRpcValue. Can only be called after sp_rpc_params_iter_next() returned TRUE, and cannot be called more than once for the same key/value pair.

The count reference of the removed value will be decreased.

iter :

an initialized SPRpcIter