Adaptive Framework
0.9.0
|
Files | |
file | afw_array_template.h |
Adaptive Framework Array Template Header. | |
file | afw_associative_array.h |
(deprecated) Adaptive Framework implementation of associative array. | |
file | afw_associative_array_template.h |
(deprecated) Adaptive Framework associative array templates | |
Data Structures | |
struct | afw_associative_array_s |
Macros | |
#define | AFW_ARRAY_TEMPLATE(_NAME, _ELEMENT_TYPE) |
Array template. More... | |
#define | AFW_ASSOCIATIVE_ARRAY_TEMPLATE(name, type) |
Typedefs | |
typedef struct afw_associative_array_s | afw_associative_array_t |
typedef void(* | afw_associative_array_add_reference_value_cb) (const void *value, afw_xctx_t *xctx) |
typedef void(* | afw_associative_array_release_value_cb) (const void *value, afw_xctx_t *xctx) |
Functions | |
AFW_ARRAY_TEMPLATE (afw_u8z_array, afw_utf8_z_t *) AFW_ARRAY_TEMPLATE(const_afw_u8z_array | |
const afw_utf8_z_t * | AFW_ARRAY_TEMPLATE (afw_char_ptr_array, char *) AFW_ARRAY_TEMPLATE(const_afw_char_ptr_array |
const afw_associative_array_t * | afw_associative_array_create (afw_associative_array_add_reference_value_cb add_reference_value, afw_associative_array_release_value_cb release_value, const afw_pool_t *p, afw_xctx_t *xctx) |
void | afw_associative_array_release (const afw_associative_array_t *instance, afw_xctx_t *xctx) |
void | afw_associative_array_add_reference (const afw_associative_array_t *instance, afw_xctx_t *xctx) |
const void * | afw_associative_array_get (const afw_associative_array_t *instance, const afw_utf8_t *key, afw_xctx_t *xctx) |
const void * | afw_associative_array_get_reference (const afw_associative_array_t *instance, const afw_utf8_t *key, afw_xctx_t *xctx) |
void | afw_associative_array_for_each (const afw_associative_array_t *instance, void *context, afw_value_cb_t callback, afw_xctx_t *xctx) |
void | afw_associative_array_set (const afw_associative_array_t *instance, const afw_utf8_t *key, const void *value, afw_xctx_t *xctx) |
(deprecated) Array Template
#define AFW_ARRAY_TEMPLATE | ( | _NAME, | |
_ELEMENT_TYPE | |||
) |
Array template.
This template creates a struct and functions to use allow use of apr_array in a type-safe way.
Some examples where:
type struct ... Something; Something *e; Something **ep; int i;
Instead of:
apr_array_header_t *array;
Do this:
APR_ARRAY_TEMPLATE(SomethingArray, Something *) SomethingArray_t *array;
Instead of:
array = apr_array_make(pool, 10, sizeof(Something *));
Do this:
array = make_SomethingArray(pool, 10);
Instead of:
*apr_array_push(array, Something *) = e;
Do this:
*push_SomethingArray(array) = e;
Instead of:
e = (*((Something **)array->elts))[i]; or e = *(((Something **)array->elts)+i);
Do this:
e = (*(array->elts))[i]; or e = *(array->elts+i);
Instead of:
ep = (Something **)array->elts; for (i = 0; i < array->nelts; i++) { (*ep) to reference ep++; }
Do this:
ep = array->elts; for (i = 0; i < array->nelts; i++) { (*ep) to reference ep++; }
Definition at line 99 of file afw_array_template.h.