libcomps: comps dictionary functions

libcomps ..

Loading...
Searching...
No Matches
Functions
comps dictionary functions

## Functions
void | comps_objdict_set (COMPS_ObjDict *rt, char *key, COMPS_Object *data)
void | comps_objdict_set_x (COMPS_ObjDict *rt, char *key, COMPS_Object *data)
void | comps_objdict_set_n (COMPS_ObjDict *rt, char *key, unsigned int len, COMPS_Object *data)
COMPS_Object * | comps_objdict_get (COMPS_ObjDict *rt, const char *key)
COMPS_Object * | comps_objdict_get_x (COMPS_ObjRTree *rt, const char *key)
void | comps_objdict_unset (COMPS_ObjDict *rt, const char *key)
void | comps_objdict_clear (COMPS_ObjDict *rt)
COMPS_HSList * | comps_objdict_values (COMPS_ObjDict *rt)
void | comps_objdict_values_walk (COMPS_ObjRTree *rt, void *udata, void(*walk_f)(void *, COMPS_Object *))
COMPS_ObjDict * | comps_objdict_clone (COMPS_ObjDict *rt)
COMPS_HSList * | comps_objdict_keys (COMPS_ObjDict *rt)
COMPS_HSList * | comps_objdict_pairs (COMPS_ObjDict *rt)
COMPS_ObjDict * | comps_objdict_union (COMPS_ObjDict *d1, COMPS_ObjDict *d2)

## Detailed Description

## Function Documentation

## ◆ comps_objdict_clear()

void comps_objdict_clear | ( | COMPS_ObjDict * | rt | ) |

remove all items from dictionary

Parameters

  rt | COMPS_ObjDict object

## ◆ comps_objdict_clone()

COMPS_ObjDict * comps_objdict_clone | ( | COMPS_ObjDict * | rt | ) |

Makes copy of dictionary

Items in new dictionary is same items with incremented reference counter only

Parameters

  rt | COMPS_ObjDict object

Returns
  new COMPS_ObjDict object

## ◆ comps_objdict_get()

COMPS_Object * comps_objdict_get | ( | COMPS_ObjDict * | rt,
|  | const char * | key )

get item from dictionary for specified key

if there's no such item, return NULL. Item's reference counter will be incremented.

Parameters

  rt | COMPS_ObjDict object
  specified | key

Returns
  item for key

## ◆ comps_objdict_get_x()

COMPS_Object * comps_objdict_get_x | ( | COMPS_ObjRTree * | rt,
|  | const char * | key )

get item from dictionary for specified key

if there's no such item, return NULL. Item's reference counter WON'T be incremented.

Parameters

  rt | COMPS_ObjDict object
  specified | key

Returns
  item for key

## ◆ comps_objdict_keys()

COMPS_HSList * comps_objdict_keys | ( | COMPS_ObjDict * | rt | ) |

Return list of keys in dictionary

Parameters

  rt | COMPS_ObjDict object

Returns
  COMPS_HSList of key in dictionary

## ◆ comps_objdict_pairs()

COMPS_HSList * comps_objdict_pairs | ( | COMPS_ObjDict * | rt | ) |

Return list of pairs(key-value) in dictionary

Parameters

  rt | COMPS_ObjDict object

Returns
  COMPS_HSList of pairs in dictionary

## ◆ comps_objdict_set()

void comps_objdict_set | ( | COMPS_ObjDict * | rt,
|  | char * | key,
|  | COMPS_Object * | data )

set new item to dictionary

if there's already item for specified key in dictionary, old item will be replaced with new item and its reference counter will be decremented. Reference counter of new item will be incremented

Parameters

  rt | COMPS_ObjDict object
  key | key for new item
  data | new item

## ◆ comps_objdict_set_n()

void comps_objdict_set_n | ( | COMPS_ObjDict * | rt,
|  | char * | key,
|  | unsigned int | len,
|  | COMPS_Object * | data )

same as comps_objdict_set but with key length limited by argument

Parameters

  rt | COMPS_ObjDict object
  key | key for new item
  len | key length limiter
  data | new item

## ◆ comps_objdict_set_x()

void comps_objdict_set_x | ( | COMPS_ObjDict * | rt,
|  | char * | key,
|  | COMPS_Object * | data )

set new item to dictionary

if there's already item for specified key in dictionary, old item will be replaced with new item and its reference counter will be decremented. Reference counter of new items won't be incremented

Parameters

  rt | COMPS_ObjDict object
  key | key for new item
  data | new item

## ◆ comps_objdict_union()

COMPS_ObjDict * comps_objdict_union | ( | COMPS_ObjDict * | d1,
|  | COMPS_ObjDict * | d2 )

Join two dictionries into one

New dictionary is filled with pairs of first dictionary and then with pairs of second dictionary with skipped items whose keys are already in dictionary

Parameters

  d1 | COMPS_ObjDict object
  d2 | COMPS_ObjDict object

Returns
  new COMPS_ObjDict object

## ◆ comps_objdict_unset()

void comps_objdict_unset | ( | COMPS_ObjDict * | rt,
|  | const char * | key )

remove item from dictionary for specified key

item's reference counter will be decremented

Parameters

  rt | COMPS_ObjDict object
  key | item's key

## ◆ comps_objdict_values()

COMPS_HSList * comps_objdict_values | ( | COMPS_ObjDict * | rt | ) |

Return list of all values(items) in dictionary

Parameters

  rt | COMPS_ObjDict objecti

Returns
  COMPS_HSList of values

## ◆ comps_objdict_values_walk()

void comps_objdict_values_walk | ( | COMPS_ObjRTree * | rt,
|  | void * | udata,
|  | void(* | walk_f )(void *, COMPS_Object *) )

Apply function for each item in dictionary

Applied function takes user data (udata param) and item as arguments

Parameters

  rt | COMPS_ObjDict object
  udata | user data
  walk_f | applied function