Cyber Garage Portable Runtime (CGPR) for C
dictionary.h File Reference
#include <cgpr/util/list.h>
#include <cgpr/util/string.h>
#include <cgpr/util/typedef.h>

Data Structures

struct  _CGDictionary
 The generic wrapper struct for mUPnP's dictionarys. More...
 

Macros

#define cg_dictionary_element_setkey(dirElem, name)
 
#define cg_dictionary_element_getkey(dirElem)
 
#define cg_dictionary_element_setvalue(dirElem, val)
 
#define cg_dictionary_element_getvalue(dirElem)
 
#define cg_dictionary_element_next(dirElem)
 
#define cg_dictionary_element_remove(dirElem)
 
#define cg_dictionary_clear(dir)
 
#define cg_dictionary_size(dir)
 
#define cg_dictionary_gets(dir)
 
#define cg_dictionary_add(dir, dirElem)
 
#define cg_dictionary_remove(dirElem)
 

Typedefs

typedef struct _CGDictionary CGDictionaryElement
 The generic wrapper struct for mUPnP's dictionarys.
 
typedef struct _CGDictionary CGDictionary
 

Functions

CGDictionaryElementcg_dictionary_element_new (void)
 
bool cg_dictionary_element_delete (CGDictionaryElement *dirElem)
 
CGDictionarycg_dictionary_new (void)
 
void cg_dictionary_delete (CGDictionary *dir)
 
CGDictionaryElementcg_dictionary_get (CGDictionary *dir, const char *key)
 
void cg_dictionary_setvalue (CGDictionary *dir, const char *key, const char *value)
 
const char * cg_dictionary_getvalue (CGDictionary *dir, const char *key)
 

Macro Definition Documentation

◆ cg_dictionary_add

#define cg_dictionary_add ( dir,
dirElem )
Value:
cg_list_add((CGList*)dir, (CGList*)dirElem)
bool cg_list_add(CGList *headList, CGList *list)
Definition list.c:114
The generic list interface in mUPnP.
Definition list.h:69

Add a dictionary into a dictionary list

Parameters
dirThe dictionary list in question
dirElemThe dictionary to add to the list

◆ cg_dictionary_clear

#define cg_dictionary_clear ( dir)
Value:
bool cg_dictionary_element_delete(CGDictionaryElement *dirElem)
Definition dictionary_elem.c:45
bool cg_list_clear(CGList *headList, CG_LIST_DESTRUCTORFUNC dstructorFunc)
Definition list.c:234
void(* CG_LIST_DESTRUCTORFUNC)(void *)
Definition list.h:42

Clear the contents of a dictionary list

Parameters
dirDictionary list in question

◆ cg_dictionary_element_getkey

#define cg_dictionary_element_getkey ( dirElem)
Value:
cg_string_getvalue(dirElem->key)
char * cg_string_getvalue(CGString *str)
Definition string.c:151

Get a key

Parameters
dirElemDictionary struct

◆ cg_dictionary_element_getvalue

#define cg_dictionary_element_getvalue ( dirElem)
Value:
cg_string_getvalue(dirElem->value)

Get a value

Parameters
dirElemDictionary struct

◆ cg_dictionary_element_next

#define cg_dictionary_element_next ( dirElem)
Value:
CGList * cg_list_next(CGList *list)
Definition list.c:216
The generic wrapper struct for mUPnP's dictionarys.
Definition dictionary.h:44

◆ cg_dictionary_element_remove

#define cg_dictionary_element_remove ( dirElem)
Value:
bool cg_list_remove(CGList *list)
Definition list.c:131

◆ cg_dictionary_element_setkey

#define cg_dictionary_element_setkey ( dirElem,
name )
Value:
cg_string_setvalue(dirElem->key, name)
void cg_string_setvalue(CGString *str, const char *value)
Definition string.c:80

Set a key

Parameters
dirElemDictionary struct
nameString to set

◆ cg_dictionary_element_setvalue

#define cg_dictionary_element_setvalue ( dirElem,
val )
Value:
cg_string_setvalue(dirElem->value, val)

Set a value

Parameters
dirElemDictionary struct
valueString to set

◆ cg_dictionary_gets

#define cg_dictionary_gets ( dir)
Value:

Get the first actual item from a dictionary list to use as an iterator

Parameters
dirThe dictionary list in question

◆ cg_dictionary_remove

#define cg_dictionary_remove ( dirElem)
Value:

Remove a dictionary from dictionary list

Parameters
dirElemThe dictionary to be removed

◆ cg_dictionary_size

#define cg_dictionary_size ( dir)
Value:
size_t cg_list_size(CGList *headList)
Definition list.c:55

Get the size of a dictionary list

Parameters
dirThe dictionary list in question

Typedef Documentation

◆ CGDictionary

typedef struct _CGDictionary CGDictionary

◆ CGDictionaryElement

The generic wrapper struct for mUPnP's dictionarys.

This wrapper has been created to enable 100% code compatibility between different platforms (Linux, Win32 etc..)

Function Documentation

◆ cg_dictionary_delete()

void cg_dictionary_delete ( CGDictionary * dir)

Destroy a dictionary list

Parameters
dirThe dictionary list in question

◆ cg_dictionary_element_delete()

bool cg_dictionary_element_delete ( CGDictionaryElement * dirElem)

Destroy a dictionary.

Parameters
dirElemDictionary to destroy

◆ cg_dictionary_element_new()

CGDictionaryElement * cg_dictionary_element_new ( void )

Create a new dictionary

◆ cg_dictionary_get()

CGDictionaryElement * cg_dictionary_get ( CGDictionary * dir,
const char * key )

Get a element of the specified key

Parameters
dirThe dictionary list in question
keyName to search.
Returns
Element of the specified key.

◆ cg_dictionary_getvalue()

const char * cg_dictionary_getvalue ( CGDictionary * dir,
const char * key )

Get a value of the specified key

Parameters
dirThe dictionary list in question
keyName to search.
Returns
Value of the specified key.

◆ cg_dictionary_new()

CGDictionary * cg_dictionary_new ( void )

Create a new dictionary list

Returns
Dictionary list

◆ cg_dictionary_setvalue()

void cg_dictionary_setvalue ( CGDictionary * dir,
const char * key,
const char * value )

Set a new element into a dictionary

Parameters
dirThe dictionary list in question
keyName to set.
valueValue to set.