Tables are used to store entirely opaque structures for applications, while Arrays are usually used to deal with string lists.
| #define APR_ARRAY_IDX | ( | ary, | |||
| i, | |||||
| type | ) | (((type *)(ary)->elts)[i]) |
A helper macro for accessing a member of an APR array.
| ary | the array
|
| #define APR_ARRAY_PUSH | ( | ary, | |||
| type | ) | (*((type *)apr_array_push(ary))) |
A helper macro for pushing elements into an APR array.
| ary | the array
|
| #define APR_OVERLAP_TABLES_MERGE (1) |
flag for overlap to use apr_table_mergen
| #define APR_OVERLAP_TABLES_SET (0) |
flag for overlap to use apr_table_setn
| typedef struct apr_array_header_t apr_array_header_t |
| typedef int( apr_table_do_callback_fn_t)(void *rec, const char *key, const char *value) |
Declaration prototype for the iterator callback function of apr_table_do() and apr_table_vdo().
| rec | The data passed as the first argument to apr_table_[v]do()
|
| typedef struct apr_table_entry_t apr_table_entry_t |
The (opaque) structure for string-content tables.
| typedef struct apr_table_t apr_table_t |
the table abstract data type
| apr_array_header_t* apr_array_append | ( | apr_pool_t * | p, | |
| const apr_array_header_t * | first, | |||
| const apr_array_header_t * | second | |||
| ) |
Append one array to the end of another, creating a new array in the process.
| p | The pool to allocate the new array out of
|
| void apr_array_cat | ( | apr_array_header_t * | dst, | |
| const apr_array_header_t * | src | |||
| ) |
Concatenate two arrays together
| dst | The destination array, and the one to go first in the combined array
|
| void apr_array_clear | ( | apr_array_header_t * | arr | ) |
Remove all elements from an array.
| arr | The array to remove all elements from.
|
| apr_array_header_t* apr_array_copy | ( | apr_pool_t * | p, | |
| const apr_array_header_t * | arr | |||
| ) |
Copy the entire array
| p | The pool to allocate the copy of the array out of
|
| apr_array_header_t* apr_array_copy_hdr | ( | apr_pool_t * | p, | |
| const apr_array_header_t * | arr | |||
| ) |
Copy the headers of the array, and arrange for the elements to be copied if and only if the code subsequently does a push or arraycat.
| p | The pool to allocate the copy of the array out of
|
| apr_array_header_t* apr_array_make | ( | apr_pool_t * | p, | |
| int | nelts, | |||
| int | elt_size | |||
| ) |
Create an array
| p | The pool to allocate the memory out of
|
| void* apr_array_pop | ( | apr_array_header_t * | arr | ) |
Remove an element from an array (as a first-in, last-out stack)
| arr | The array to remove an element from.
|
| char* apr_array_pstrcat | ( | apr_pool_t * | p, | |
| const apr_array_header_t * | arr, | |||
| const char | sep | |||
| ) |
Generates a new string from the apr_pool_t containing the concatenated sequence of substrings referenced as elements within the array. The string will be empty if all substrings are empty or null, or if there are no elements in the array. If sep is non-NUL, it will be inserted between elements as a separator.
| p | The pool to allocate the string out of
|
| void* apr_array_push | ( | apr_array_header_t * | arr | ) |
Add a new element to an array (as a first-in, last-out stack)
| arr | The array to add an element to.
|
| int apr_is_empty_array | ( | const apr_array_header_t * | a | ) |
Determine if the array is empty (either NULL or having no elements)
| a | The array to check
|
| int apr_is_empty_table | ( | const apr_table_t * | t | ) |
Determine if the table is empty (either NULL or having no elements)
| t | The table to check
|
| void apr_table_add | ( | apr_table_t * | t, | |
| const char * | key, | |||
| const char * | val | |||
| ) |
Add data to a table, regardless of whether there is another element with the same key.
| t | The table to add to
|
| void apr_table_addn | ( | apr_table_t * | t, | |
| const char * | key, | |||
| const char * | val | |||
| ) |
Add data to a table, regardless of whether there is another element with the same key.
| t | The table to add to
|
| void apr_table_clear | ( | apr_table_t * | t | ) |
Delete all of the elements from a table
| t | The table to clear |
| apr_table_t* apr_table_clone | ( | apr_pool_t * | p, | |
| const apr_table_t * | t | |||
| ) |
Create a new table whose contents are deep copied from the given table. A deep copy operation copies all fields, and makes copies of dynamically allocated memory pointed to by the fields.
| p | The pool to allocate the new table out of
|
| void apr_table_compress | ( | apr_table_t * | t, | |
| unsigned | flags | |||
| ) |
Eliminate redundant entries in a table by either overwriting or merging duplicates
| t | Table.
|
| apr_table_t* apr_table_copy | ( | apr_pool_t * | p, | |
| const apr_table_t * | t | |||
| ) |
Create a new table and copy another table into it
| p | The pool to allocate the new table out of
|
| int apr_table_do | ( | apr_table_do_callback_fn_t * | comp, | |
| void * | rec, | |||
| const apr_table_t * | t, | |||
| ... | ||||
| ) |
Iterate over a table running the provided function once for every element in the table. The varargs array must be a list of zero or more (char *) keys followed by a NULL pointer. If zero keys are given, the
| comp | function will be invoked for every element in the table. Otherwise, the function is invoked only for those elements matching the keys specified. |
| comp | function returns zero, iteration will continue using the next specified key, if any. | ||||||||||
| comp | The function to run
|
| const apr_array_header_t* apr_table_elts | ( | const apr_table_t * | t | ) |
Get the elements from a table
| t | The table
|
| const char* apr_table_get | ( | const apr_table_t * | t, | |
| const char * | key | |||
| ) |
Get the value associated with a given key from the table. After this call, The data is still in the table
| t | The table to search for the key
|
| apr_table_t* apr_table_make | ( | apr_pool_t * | p, | |
| int | nelts | |||
| ) |
Make a new table
| p | The pool to allocate the pool out of
|
| void apr_table_merge | ( | apr_table_t * | t, | |
| const char * | key, | |||
| const char * | val | |||
| ) |
Add data to a table by merging the value with data that has already been stored
| t | The table to search for the data
|
| void apr_table_mergen | ( | apr_table_t * | t, | |
| const char * | key, | |||
| const char * | val | |||
| ) |
Add data to a table by merging the value with data that has already been stored
| t | The table to search for the data
|
| void apr_table_overlap | ( | apr_table_t * | a, | |
| const apr_table_t * | b, | |||
| unsigned | flags | |||
| ) |
For each element in table b, either use setn or mergen to add the data to table a. Which method is used is determined by the flags passed in.
| a | The table to add the data to.
|
| apr_table_t* apr_table_overlay | ( | apr_pool_t * | p, | |
| const apr_table_t * | overlay, | |||
| const apr_table_t * | base | |||
| ) |
Merge two tables into one new table
| p | The pool to use for the new table
|
| void apr_table_set | ( | apr_table_t * | t, | |
| const char * | key, | |||
| const char * | val | |||
| ) |
Add a key/value pair to a table, if another element already exists with the same key, this will over-write the old data.
| t | The table to add the data to.
|
| void apr_table_setn | ( | apr_table_t * | t, | |
| const char * | key, | |||
| const char * | val | |||
| ) |
Add a key/value pair to a table, if another element already exists with the same key, this will over-write the old data.
| t | The table to add the data to.
|
| void apr_table_unset | ( | apr_table_t * | t, | |
| const char * | key | |||
| ) |
Remove data from the table
| t | The table to remove data from
|
| int apr_table_vdo | ( | apr_table_do_callback_fn_t * | comp, | |
| void * | rec, | |||
| const apr_table_t * | t, | |||
| va_list | vp | |||
| ) |
Iterate over a table running the provided function once for every element in the table. The
| vp | varargs paramater must be a list of zero or more (char *) keys followed by a NULL pointer. If zero keys are given, the
|
1.6.3