c-icap-doc  0.1
Macros | Typedefs | Functions
Arrays of pointers

Arrays of name/pointers to objects pairs. More...

Macros

#define ci_ptr_array_value(array, pos)   ci_array_value((ci_array_t *)(array), pos)
 Return the value of item at position 'pos'. More...
 
#define ci_ptr_array_new   ci_array_new
 Create a new ci_ptr_array_t object. More...
 
#define ci_ptr_array_destroy(ptr_array)   ci_array_destroy((ci_array_t *)(ptr_array))
 Destroy a ci_ptr_array_t object. More...
 
#define ci_ptr_array_iterate(ptr_array, data, fn)   ci_array_iterate((ci_array_t *)(ptr_array), data, fn)
 Run the function fn for each item of the ci_ptr_array_t object. More...
 
#define ci_ptr_array_get_item(array, pos)   ci_array_get_item((ci_array_t *)(array), pos)
 Get an array item. More...
 

Typedefs

typedef ci_array_t ci_ptr_array_t
 The ci_ptr_array_t objects can store a list of name and pointer to object pairs. More...
 

Functions

ci_ptr_array_tci_ptr_array_new2 (size_t items)
 Create and initialize an ci_ptr_array_t object for the given number of items. More...
 
void * ci_ptr_array_search (ci_ptr_array_t *array, const char *name)
 Search in an array for an item with the given name. More...
 
const ci_array_item_t * ci_ptr_array_add (ci_ptr_array_t *ptr_array, const char *name, void *value)
 Add an name/value pair item to the ci_ptr_array_t object. More...
 
const ci_array_item_t * ci_ptr_array_pop (ci_ptr_array_t *ptr_array)
 Pop and delete the last item of a ci_ptr_array_t object. More...
 
void * ci_ptr_array_pop_value (ci_ptr_array_t *ptr_array, char *name, size_t name_size)
 Pop and delete the last item of a ci_ptr_array_t object. More...
 

Detailed Description

Arrays of name/pointers to objects pairs.

Macro Definition Documentation

#define ci_ptr_array_destroy (   ptr_array)    ci_array_destroy((ci_array_t *)(ptr_array))

Destroy a ci_ptr_array_t object.

Similar to the ci_array_destroy function

#define ci_ptr_array_get_item (   array,
  pos 
)    ci_array_get_item((ci_array_t *)(array), pos)

Get an array item.

Wrapper to the ci_array_get_item() function.

#define ci_ptr_array_iterate (   ptr_array,
  data,
  fn 
)    ci_array_iterate((ci_array_t *)(ptr_array), data, fn)

Run the function fn for each item of the ci_ptr_array_t object.

Similar to the ci_array_iterate function

#define ci_ptr_array_new   ci_array_new

Create a new ci_ptr_array_t object.

Similar to the ci_array_new() function.

#define ci_ptr_array_value (   array,
  pos 
)    ci_array_value((ci_array_t *)(array), pos)

Return the value of item at position 'pos'.

Return the size of ptr_array.

Return the name of item at position 'pos'.

Typedef Documentation

The ci_ptr_array_t objects can store a list of name and pointer to object pairs.

It is similar to the ci_array_t object but does not store the value but a pointer to the value.

Function Documentation

const ci_array_item_t* ci_ptr_array_add ( ci_ptr_array_t ptr_array,
const char *  name,
void *  value 
)

Add an name/value pair item to the ci_ptr_array_t object.

Parameters
ptr_arraya pointer to the ci_ptr_array_t object
namethe name part of the name/value pair item to be added
valuea pointer to the value part of the name/value pair item to be added
Returns
a pointer to the new array item on success, NULL otherwise
ci_ptr_array_t* ci_ptr_array_new2 ( size_t  items)

Create and initialize an ci_ptr_array_t object for the given number of items.

Parameters
itemsthe maximum aray items
Returns
the allocated object on success, or NULL on failure
const ci_array_item_t* ci_ptr_array_pop ( ci_ptr_array_t ptr_array)

Pop and delete the last item of a ci_ptr_array_t object.

Parameters
ptr_arraya pointer to the ci_ptr_array_t object
Returns
a pointer to the popped array item
void* ci_ptr_array_pop_value ( ci_ptr_array_t ptr_array,
char *  name,
size_t  name_size 
)

Pop and delete the last item of a ci_ptr_array_t object.

Parameters
ptr_arraya pointer to the ci_ptr_array_t object
namea pointer to a buffer where the name of the poped item will be store, or NULL
name_sizethe size of name buffer
Returns
a pointer to the value of the popped item
void* ci_ptr_array_search ( ci_ptr_array_t array,
const char *  name 
)

Search in an array for an item with the given name.

Parameters
arraya pointer to the ci_ptr_array_t object
namethe item to be search for.
Returns
pointer to the value pair of the array item if found, NULL otherwise