📄 apr_tables.h
字号:
* @return A string containing all of the data in the array. * @deffunc char *apr_array_pstrcat(apr_pool_t *p, const apr_array_header_t *arr, const char sep) */APR_DECLARE(char *) apr_array_pstrcat(struct apr_pool_t *p, const apr_array_header_t *arr, const char sep);/** * Make a new table * @param p The pool to allocate the pool out of * @param nelts The number of elements in the initial table. * @return The new table. * @warning This table can only store text data * @deffunc apr_table_t *apr_table_make(apr_pool_t *p, int nelts) */APR_DECLARE(apr_table_t *) apr_table_make(struct apr_pool_t *p, int nelts);/** * Create a new table and copy another table into it * @param p The pool to allocate the new table out of * @param t The table to copy * @return A copy of the table passed in * @deffunc apr_table_t *apr_table_copy(apr_pool_t *p, const apr_table_t *t) */APR_DECLARE(apr_table_t *) apr_table_copy(struct apr_pool_t *p, const apr_table_t *t);/** * Delete all of the elements from a table * @param t The table to clear * @deffunc void apr_table_clear(apr_table_t *t) */APR_DECLARE(void) apr_table_clear(apr_table_t *t);/** * Get the value associated with a given key from the table. After this call, * The data is still in the table * @param t The table to search for the key * @param key The key to search for * @return The value associated with the key * @deffunc const char *apr_table_get(const apr_table_t *t, const char *key) */APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);/** * Add a key/value pair to a table, if another element already exists with the * same key, this will over-write the old data. * @param t The table to add the data to. * @param key The key fo use * @param val The value to add * @tip When adding data, this function makes a copy of both the key and the * value. * @deffunc void apr_table_set(apr_table_t *t, const char *key, const char *val) */APR_DECLARE(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. * @param t The table to add the data to. * @param key The key fo use * @param val The value to add * @tip When adding data, this function does not make a copy of the key or the * value, so care should be taken to ensure that the values will not * change after they have been added.. * @deffunc void apr_table_setn(apr_table_t *t, const char *key, const char *val) */APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, const char *val);/** * Remove data from the table * @param t The table to remove data from * @param key The key of the data being removed * @deffunc void apr_table_unset(apr_table_t *t, const char *key) */APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);/** * Add data to a table by merging the value with data that has already been * stored * @param t The table to search for the data * @param key The key to merge data for * @param val The data to add * @tip If the key is not found, then this function acts like apr_table_add * @deffunc void apr_table_merge(apr_table_t *t, const char *key, const char *val) */APR_DECLARE(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 * @param t The table to search for the data * @param key The key to merge data for * @param val The data to add * @tip If the key is not found, then this function acts like apr_table_addn * @deffunc void apr_table_mergen(apr_table_t *t, const char *key, const char *val) */APR_DECLARE(void) apr_table_mergen(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. * @param t The table to add to * @param key The key to use * @param val The value to add. * @tip When adding data, this function makes a copy of both the key and the * value. * @deffunc void apr_table_add(apr_table_t *t, const char *key, const char *val) */APR_DECLARE(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. * @param t The table to add to * @param key The key to use * @param val The value to add. * @tip When adding data, this function does not make a copy of the key or the * value, so care should be taken to ensure that the values will not * change after they have been added.. * @deffunc void apr_table_addn(apr_table_t *t, const char *key, const char *val) */APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key, const char *val);/** * Merge two tables into one new table * @param p The pool to use for the new table * @param overlay The first table to put in the new table * @param base The table to add at the end of the new table * @return A new table containing all of the data from the two passed in * @deffunc apr_table_t *apr_table_overlay(apr_pool_t *p, const apr_table_t *overlay, const apr_table_t *base); */APR_DECLARE(apr_table_t *) apr_table_overlay(struct apr_pool_t *p, const apr_table_t *overlay, const apr_table_t *base);/** * Iterate over a table running the provided function once for every * element in the table. If there is data passed in as a vararg, then the * function is only run on those element's whose key matches something in * the vararg. If the vararg is NULL, then every element is run through the * function. * @param comp The function to run * @param rec The data to pass as the first argument to the function * @param t The table to iterate over * @param ... The vararg. If this is NULL, then all elements in the table are * run through the function, otherwise only those whose key matches * are run. * @deffunc void apr_table_do(int (*comp) (void *, const char *, const char *), void *rec, const apr_table_t *t, ...) */APR_DECLARE_NONSTD(void) apr_table_do(int (*comp)(void *, const char *, const char *), void *rec, const apr_table_t *t, ...);/** * Iterate over a table running the provided function once for every * element in the table. If there is data passed in as a vararg, then the * function is only run on those element's whose key matches something in * the vararg. If the vararg is NULL, then every element is run through the * function. * @param comp The function to run * @param rec The data to pass as the first argument to the function * @param t The table to iterate over * @param vp The vararg table. If this is NULL, then all elements in the * table are run through the function, otherwise only those * whose key matches are run. * @deffunc void apr_table_vdo(int (*comp) (void *, const char *, const char *), void *rec, const apr_table_t *t, va_list vp) */APR_DECLARE(void) apr_table_vdo(int (*comp)(void *, const char *, const char *), void *rec, const apr_table_t *t, va_list);/* Conceptually, apr_table_overlap does this: * * apr_array_header_t *barr = apr_table_elts(b); * apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts; * int i; * * for (i = 0; i < barr->nelts; ++i) { * if (flags & APR_OVERLAP_TABLES_MERGE) { * apr_table_mergen(a, belt[i].key, belt[i].val); * } * else { * apr_table_setn(a, belt[i].key, belt[i].val); * } * } * * Except that it is more efficient (less space and cpu-time) especially * when b has many elements. * * Notice the assumptions on the keys and values in b -- they must be * in an ancestor of a's pool. In practice b and a are usually from * the same pool. */#define APR_OVERLAP_TABLES_SET (0)#define APR_OVERLAP_TABLES_MERGE (1)/** * 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. * @param a The table to add the data to. * @param b The table to iterate over, adding it's data to table a * @param flags How to add the table to table a. One of: * APR_OVERLAP_TABLES_SET Use apr_table_setn * APR_OVERLAP_TABLES_MERGE Use apr_table_mergen * @tip This function is highly optimized, and uses less memory and CPU cycles * than a function that just loops through table b calling other functions. * @deffunc void apr_table_overlap(apr_table_t *a, const apr_table_t *b, unsigned flags) */APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, unsigned flags);#ifdef __cplusplus}#endif#endif /* ! APR_TABLES_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -