Sophie

Sophie

distrib > Mandriva > 10.2 > i586 > media > contrib > by-pkgid > 4f37b923758ceff94a2c0ccca62b4b43 > files > 108

libapr1-devel-1.1.1-1mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: apr_tables.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">home</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">oden</a>&nbsp;/&nbsp;<a class="el" href="dir_000002.html">RPM</a>&nbsp;/&nbsp;<a class="el" href="dir_000003.html">BUILD</a>&nbsp;/&nbsp;<a class="el" href="dir_000004.html">apr-1.1.1</a>&nbsp;/&nbsp;<a class="el" href="dir_000005.html">include</a></div>
<h1>apr_tables.h</h1><a href="apr__tables_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span>
00002 <span class="comment"> *</span>
00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00004 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00005 <span class="comment"> * You may obtain a copy of the License at</span>
00006 <span class="comment"> *</span>
00007 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00012 <span class="comment"> * See the License for the specific language governing permissions and</span>
00013 <span class="comment"> * limitations under the License.</span>
00014 <span class="comment"> */</span>
00015 
00016 <span class="preprocessor">#ifndef APR_TABLES_H</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_TABLES_H</span>
00018 <span class="preprocessor"></span><span class="comment"></span>
00019 <span class="comment">/**</span>
00020 <span class="comment"> * @file apr_tables.h</span>
00021 <span class="comment"> * @brief APR Table library</span>
00022 <span class="comment"> */</span>
00023 
00024 <span class="preprocessor">#include "<a class="code" href="apr_8h.html">apr.h</a>"</span>
00025 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00026 
00027 <span class="preprocessor">#if APR_HAVE_STDARG_H</span>
00028 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdarg.h&gt;</span>     <span class="comment">/* for va_list */</span>
00029 <span class="preprocessor">#endif</span>
00030 <span class="preprocessor"></span>
00031 <span class="preprocessor">#ifdef __cplusplus</span>
00032 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00033 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00034 <span class="comment"></span>
00035 <span class="comment">/**</span>
00036 <span class="comment"> * @defgroup apr_tables Table and Array Functions</span>
00037 <span class="comment"> * @ingroup APR </span>
00038 <span class="comment"> * Tables are used to store entirely opaque structures </span>
00039 <span class="comment"> * for applications, while Arrays are usually used to</span>
00040 <span class="comment"> * deal with string lists.</span>
00041 <span class="comment"> * @{</span>
00042 <span class="comment"> */</span>
00043 <span class="comment"></span>
00044 <span class="comment">/** the table abstract data type */</span>
<a name="l00045"></a><a class="code" href="group__apr__tables.html#ga0">00045</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__tables.html#ga0">apr_table_t</a> <a class="code" href="group__apr__tables.html#ga0">apr_table_t</a>;
00046 <span class="comment"></span>
00047 <span class="comment">/** @see apr_array_header_t */</span>
<a name="l00048"></a><a class="code" href="group__apr__tables.html#ga1">00048</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__array__header__t.html">apr_array_header_t</a> <a class="code" href="group__apr__tables.html#ga1">apr_array_header_t</a>;
00049 <span class="comment"></span>
00050 <span class="comment">/** An opaque array type */</span>
<a name="l00051"></a><a class="code" href="structapr__array__header__t.html">00051</a> <span class="keyword">struct </span><a class="code" href="group__apr__tables.html#ga1">apr_array_header_t</a> {<span class="comment"></span>
00052 <span class="comment">    /** The pool the array is allocated out of */</span>
<a name="l00053"></a><a class="code" href="structapr__array__header__t.html#o0">00053</a>     <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *pool;<span class="comment"></span>
00054 <span class="comment">    /** The amount of memory allocated for each element of the array */</span>
<a name="l00055"></a><a class="code" href="structapr__array__header__t.html#o1">00055</a>     <span class="keywordtype">int</span> elt_size;<span class="comment"></span>
00056 <span class="comment">    /** The number of active elements in the array */</span>
<a name="l00057"></a><a class="code" href="structapr__array__header__t.html#o2">00057</a>     <span class="keywordtype">int</span> nelts;<span class="comment"></span>
00058 <span class="comment">    /** The number of elements allocated in the array */</span>
<a name="l00059"></a><a class="code" href="structapr__array__header__t.html#o3">00059</a>     <span class="keywordtype">int</span> nalloc;<span class="comment"></span>
00060 <span class="comment">    /** The elements in the array */</span>
<a name="l00061"></a><a class="code" href="structapr__array__header__t.html#o4">00061</a>     <span class="keywordtype">char</span> *elts;
00062 };
00063 <span class="comment"></span>
00064 <span class="comment">/**</span>
00065 <span class="comment"> * The (opaque) structure for string-content tables.</span>
00066 <span class="comment"> */</span>
<a name="l00067"></a><a class="code" href="group__apr__tables.html#ga2">00067</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__table__entry__t.html">apr_table_entry_t</a> <a class="code" href="group__apr__tables.html#ga2">apr_table_entry_t</a>;
00068 <span class="comment"></span>
00069 <span class="comment">/** The type for each entry in a string-content table */</span>
<a name="l00070"></a><a class="code" href="structapr__table__entry__t.html">00070</a> <span class="keyword">struct </span><a class="code" href="group__apr__tables.html#ga2">apr_table_entry_t</a> {<span class="comment"></span>
00071 <span class="comment">    /** The key for the current table entry */</span>
<a name="l00072"></a><a class="code" href="structapr__table__entry__t.html#o0">00072</a>     <span class="keywordtype">char</span> *key;          <span class="comment">/* maybe NULL in future;</span>
00073 <span class="comment">                         * check when iterating thru table_elts</span>
00074 <span class="comment">                         */</span><span class="comment"></span>
00075 <span class="comment">    /** The value for the current table entry */</span>
<a name="l00076"></a><a class="code" href="structapr__table__entry__t.html#o1">00076</a>     <span class="keywordtype">char</span> *val;
00077 <span class="comment"></span>
00078 <span class="comment">    /** A checksum for the key, for use by the apr_table internals */</span>
<a name="l00079"></a><a class="code" href="structapr__table__entry__t.html#o2">00079</a>     apr_uint32_t key_checksum;
00080 };
00081 <span class="comment"></span>
00082 <span class="comment">/**</span>
00083 <span class="comment"> * Get the elements from a table</span>
00084 <span class="comment"> * @param t The table</span>
00085 <span class="comment"> * @return An array containing the contents of the table</span>
00086 <span class="comment"> */</span>
00087 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(<span class="keyword">const</span> apr_array_header_t *) apr_table_elts(const apr_table_t *t);
00088 <span class="comment"></span>
00089 <span class="comment">/**</span>
00090 <span class="comment"> * Determine if the table is empty</span>
00091 <span class="comment"> * @param t The table to check</span>
00092 <span class="comment"> * @return True if empty, False otherwise</span>
00093 <span class="comment"> */</span>
00094 APR_DECLARE(<span class="keywordtype">int</span>) apr_is_empty_table(const apr_table_t *t);
00095 <span class="comment"></span>
00096 <span class="comment">/**</span>
00097 <span class="comment"> * Determine if the array is empty</span>
00098 <span class="comment"> * @param a The array to check</span>
00099 <span class="comment"> * @return True if empty, False otherwise</span>
00100 <span class="comment"> */</span>
00101 APR_DECLARE(<span class="keywordtype">int</span>) apr_is_empty_array(const apr_array_header_t *a);
00102 <span class="comment"></span>
00103 <span class="comment">/**</span>
00104 <span class="comment"> * Create an array</span>
00105 <span class="comment"> * @param p The pool to allocate the memory out of</span>
00106 <span class="comment"> * @param nelts the number of elements in the initial array</span>
00107 <span class="comment"> * @param elt_size The size of each element in the array.</span>
00108 <span class="comment"> * @return The new array</span>
00109 <span class="comment"> */</span>
00110 APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
00111                                                  <span class="keywordtype">int</span> nelts, <span class="keywordtype">int</span> elt_size);
00112 <span class="comment"></span>
00113 <span class="comment">/**</span>
00114 <span class="comment"> * Add a new element to an array (as a first-in, last-out stack)</span>
00115 <span class="comment"> * @param arr The array to add an element to.</span>
00116 <span class="comment"> * @return Location for the new element in the array.</span>
00117 <span class="comment"> * @remark If there are no free spots in the array, then this function will</span>
00118 <span class="comment"> *         allocate new space for the new element.</span>
00119 <span class="comment"> */</span>
00120 APR_DECLARE(<span class="keywordtype">void</span> *) apr_array_push(apr_array_header_t *arr);
00121 <span class="comment"></span>
00122 <span class="comment">/**</span>
00123 <span class="comment"> * Remove an element from an array (as a first-in, last-out stack)</span>
00124 <span class="comment"> * @param arr The array to remove an element from.</span>
00125 <span class="comment"> * @return Location of the element in the array.</span>
00126 <span class="comment"> * @remark If there are no elements in the array, NULL is returned.</span>
00127 <span class="comment"> */</span>
00128 APR_DECLARE(<span class="keywordtype">void</span> *) apr_array_pop(apr_array_header_t *arr);
00129 <span class="comment"></span>
00130 <span class="comment">/**</span>
00131 <span class="comment"> * Concatenate two arrays together</span>
00132 <span class="comment"> * @param dst The destination array, and the one to go first in the combined </span>
00133 <span class="comment"> *            array</span>
00134 <span class="comment"> * @param src The source array to add to the destination array</span>
00135 <span class="comment"> */</span>
00136 APR_DECLARE(<span class="keywordtype">void</span>) apr_array_cat(apr_array_header_t *dst,
00137                                 const apr_array_header_t *src);
00138 <span class="comment"></span>
00139 <span class="comment">/**</span>
00140 <span class="comment"> * Copy the entire array</span>
00141 <span class="comment"> * @param p The pool to allocate the copy of the array out of</span>
00142 <span class="comment"> * @param arr The array to copy</span>
00143 <span class="comment"> * @return An exact copy of the array passed in</span>
00144 <span class="comment"> * @remark The alternate apr_array_copy_hdr copies only the header, and arranges </span>
00145 <span class="comment"> *         for the elements to be copied if (and only if) the code subsequently</span>
00146 <span class="comment"> *         does a push or arraycat.</span>
00147 <span class="comment"> */</span>
00148 APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
00149                                       const apr_array_header_t *arr);<span class="comment"></span>
00150 <span class="comment">/**</span>
00151 <span class="comment"> * Copy the headers of the array, and arrange for the elements to be copied if</span>
00152 <span class="comment"> * and only if the code subsequently does a push or arraycat.</span>
00153 <span class="comment"> * @param p The pool to allocate the copy of the array out of</span>
00154 <span class="comment"> * @param arr The array to copy</span>
00155 <span class="comment"> * @return An exact copy of the array passed in</span>
00156 <span class="comment"> * @remark The alternate apr_array_copy copies the *entire* array.</span>
00157 <span class="comment"> */</span>
00158 APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p,
00159                                       const apr_array_header_t *arr);
00160 <span class="comment"></span>
00161 <span class="comment">/**</span>
00162 <span class="comment"> * Append one array to the end of another, creating a new array in the process.</span>
00163 <span class="comment"> * @param p The pool to allocate the new array out of</span>
00164 <span class="comment"> * @param first The array to put first in the new array.</span>
00165 <span class="comment"> * @param second The array to put second in the new array.</span>
00166 <span class="comment"> * @return A new array containing the data from the two arrays passed in.</span>
00167 <span class="comment">*/</span>
00168 APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p,
00169                                       const apr_array_header_t *first,
00170                                       const apr_array_header_t *second);
00171 <span class="comment"></span>
00172 <span class="comment">/**</span>
00173 <span class="comment"> * Generates a new string from the apr_pool_t containing the concatenated </span>
00174 <span class="comment"> * sequence of substrings referenced as elements within the array.  The string </span>
00175 <span class="comment"> * will be empty if all substrings are empty or null, or if there are no </span>
00176 <span class="comment"> * elements in the array.  If sep is non-NUL, it will be inserted between </span>
00177 <span class="comment"> * elements as a separator.</span>
00178 <span class="comment"> * @param p The pool to allocate the string out of</span>
00179 <span class="comment"> * @param arr The array to generate the string from</span>
00180 <span class="comment"> * @param sep The separator to use</span>
00181 <span class="comment"> * @return A string containing all of the data in the array.</span>
00182 <span class="comment"> */</span>
00183 APR_DECLARE(<span class="keywordtype">char</span> *) apr_array_pstrcat(apr_pool_t *p,
00184                                       const apr_array_header_t *arr,
00185                                       const <span class="keywordtype">char</span> sep);
00186 <span class="comment"></span>
00187 <span class="comment">/**</span>
00188 <span class="comment"> * Make a new table</span>
00189 <span class="comment"> * @param p The pool to allocate the pool out of</span>
00190 <span class="comment"> * @param nelts The number of elements in the initial table.</span>
00191 <span class="comment"> * @return The new table.</span>
00192 <span class="comment"> * @warning This table can only store text data</span>
00193 <span class="comment"> */</span>
00194 APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, <span class="keywordtype">int</span> nelts);
00195 <span class="comment"></span>
00196 <span class="comment">/**</span>
00197 <span class="comment"> * Create a new table and copy another table into it</span>
00198 <span class="comment"> * @param p The pool to allocate the new table out of</span>
00199 <span class="comment"> * @param t The table to copy</span>
00200 <span class="comment"> * @return A copy of the table passed in</span>
00201 <span class="comment"> */</span>
00202 APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
00203                                           const apr_table_t *t);
00204 <span class="comment"></span>
00205 <span class="comment">/**</span>
00206 <span class="comment"> * Delete all of the elements from a table</span>
00207 <span class="comment"> * @param t The table to clear</span>
00208 <span class="comment"> */</span>
00209 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_clear(apr_table_t *t);
00210 <span class="comment"></span>
00211 <span class="comment">/**</span>
00212 <span class="comment"> * Get the value associated with a given key from the table.  After this call,</span>
00213 <span class="comment"> * The data is still in the table</span>
00214 <span class="comment"> * @param t The table to search for the key</span>
00215 <span class="comment"> * @param key The key to search for</span>
00216 <span class="comment"> * @return The value associated with the key</span>
00217 <span class="comment"> */</span>
00218 APR_DECLARE(const <span class="keywordtype">char</span> *) apr_table_get(const apr_table_t *t, const <span class="keywordtype">char</span> *key);
00219 <span class="comment"></span>
00220 <span class="comment">/**</span>
00221 <span class="comment"> * Add a key/value pair to a table, if another element already exists with the</span>
00222 <span class="comment"> * same key, this will over-write the old data.</span>
00223 <span class="comment"> * @param t The table to add the data to.</span>
00224 <span class="comment"> * @param key The key fo use</span>
00225 <span class="comment"> * @param val The value to add</span>
00226 <span class="comment"> * @remark When adding data, this function makes a copy of both the key and the</span>
00227 <span class="comment"> *         value.</span>
00228 <span class="comment"> */</span>
00229 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_set(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00230                                 const <span class="keywordtype">char</span> *val);
00231 <span class="comment"></span>
00232 <span class="comment">/**</span>
00233 <span class="comment"> * Add a key/value pair to a table, if another element already exists with the</span>
00234 <span class="comment"> * same key, this will over-write the old data.</span>
00235 <span class="comment"> * @param t The table to add the data to.</span>
00236 <span class="comment"> * @param key The key to use</span>
00237 <span class="comment"> * @param val The value to add</span>
00238 <span class="comment"> * @warning When adding data, this function does not make a copy of the key or </span>
00239 <span class="comment"> *          the value, so care should be taken to ensure that the values will </span>
00240 <span class="comment"> *          not change after they have been added..</span>
00241 <span class="comment"> */</span>
00242 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_setn(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00243                                  const <span class="keywordtype">char</span> *val);
00244 <span class="comment"></span>
00245 <span class="comment">/**</span>
00246 <span class="comment"> * Remove data from the table</span>
00247 <span class="comment"> * @param t The table to remove data from</span>
00248 <span class="comment"> * @param key The key of the data being removed</span>
00249 <span class="comment"> */</span>
00250 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_unset(apr_table_t *t, const <span class="keywordtype">char</span> *key);
00251 <span class="comment"></span>
00252 <span class="comment">/**</span>
00253 <span class="comment"> * Add data to a table by merging the value with data that has already been </span>
00254 <span class="comment"> * stored</span>
00255 <span class="comment"> * @param t The table to search for the data</span>
00256 <span class="comment"> * @param key The key to merge data for</span>
00257 <span class="comment"> * @param val The data to add</span>
00258 <span class="comment"> * @remark If the key is not found, then this function acts like apr_table_add</span>
00259 <span class="comment"> */</span>
00260 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_merge(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00261                                   const <span class="keywordtype">char</span> *val);
00262 <span class="comment"></span>
00263 <span class="comment">/**</span>
00264 <span class="comment"> * Add data to a table by merging the value with data that has already been </span>
00265 <span class="comment"> * stored</span>
00266 <span class="comment"> * @param t The table to search for the data</span>
00267 <span class="comment"> * @param key The key to merge data for</span>
00268 <span class="comment"> * @param val The data to add</span>
00269 <span class="comment"> * @remark If the key is not found, then this function acts like apr_table_addn</span>
00270 <span class="comment"> */</span>
00271 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_mergen(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00272                                    const <span class="keywordtype">char</span> *val);
00273 <span class="comment"></span>
00274 <span class="comment">/**</span>
00275 <span class="comment"> * Add data to a table, regardless of whether there is another element with the</span>
00276 <span class="comment"> * same key.</span>
00277 <span class="comment"> * @param t The table to add to</span>
00278 <span class="comment"> * @param key The key to use</span>
00279 <span class="comment"> * @param val The value to add.</span>
00280 <span class="comment"> * @remark When adding data, this function makes a copy of both the key and the</span>
00281 <span class="comment"> *         value.</span>
00282 <span class="comment"> */</span>
00283 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_add(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00284                                 const <span class="keywordtype">char</span> *val);
00285 <span class="comment"></span>
00286 <span class="comment">/**</span>
00287 <span class="comment"> * Add data to a table, regardless of whether there is another element with the</span>
00288 <span class="comment"> * same key.</span>
00289 <span class="comment"> * @param t The table to add to</span>
00290 <span class="comment"> * @param key The key to use</span>
00291 <span class="comment"> * @param val The value to add.</span>
00292 <span class="comment"> * @remark When adding data, this function does not make a copy of the key or the</span>
00293 <span class="comment"> *         value, so care should be taken to ensure that the values will not </span>
00294 <span class="comment"> *         change after they have been added..</span>
00295 <span class="comment"> */</span>
00296 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_addn(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00297                                  const <span class="keywordtype">char</span> *val);
00298 <span class="comment"></span>
00299 <span class="comment">/**</span>
00300 <span class="comment"> * Merge two tables into one new table</span>
00301 <span class="comment"> * @param p The pool to use for the new table</span>
00302 <span class="comment"> * @param overlay The first table to put in the new table</span>
00303 <span class="comment"> * @param base The table to add at the end of the new table</span>
00304 <span class="comment"> * @return A new table containing all of the data from the two passed in</span>
00305 <span class="comment"> */</span>
00306 APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p,
00307                                              const apr_table_t *overlay,
00308                                              const apr_table_t *base);
00309 <span class="comment"></span>
00310 <span class="comment">/**</span>
00311 <span class="comment"> * Declaration prototype for the iterator callback function of apr_table_do()</span>
00312 <span class="comment"> * and apr_table_vdo().</span>
00313 <span class="comment"> * @param rec The data passed as the first argument to apr_table_[v]do()</span>
00314 <span class="comment"> * @param key The key from this iteration of the table</span>
00315 <span class="comment"> * @param value The value from this iteration of the table</span>
00316 <span class="comment"> * @remark Iteration continues while this callback function returns non-zero.</span>
00317 <span class="comment"> * To export the callback function for apr_table_[v]do() it must be declared </span>
00318 <span class="comment"> * in the _NONSTD convention.</span>
00319 <span class="comment"> */</span>
<a name="l00320"></a><a class="code" href="group__apr__tables.html#ga3">00320</a> typedef <span class="keywordtype">int</span> (apr_table_do_callback_fn_t)(<span class="keywordtype">void</span> *rec, const <span class="keywordtype">char</span> *key, 
00321                                                     const <span class="keywordtype">char</span> *value);
00322 <span class="comment"></span>
00323 <span class="comment">/** </span>
00324 <span class="comment"> * Iterate over a table running the provided function once for every</span>
00325 <span class="comment"> * element in the table.  If there is data passed in as a vararg, then the </span>
00326 <span class="comment"> * function is only run on those elements whose key matches something in </span>
00327 <span class="comment"> * the vararg.  If the vararg is NULL, then every element is run through the</span>
00328 <span class="comment"> * function.  Iteration continues while the function returns non-zero.</span>
00329 <span class="comment"> * @param comp The function to run</span>
00330 <span class="comment"> * @param rec The data to pass as the first argument to the function</span>
00331 <span class="comment"> * @param t The table to iterate over</span>
00332 <span class="comment"> * @param ... The vararg.  If this is NULL, then all elements in the table are</span>
00333 <span class="comment"> *            run through the function, otherwise only those whose key matches</span>
00334 <span class="comment"> *            are run.</span>
00335 <span class="comment"> * @return FALSE if one of the comp() iterations returned zero; TRUE if all</span>
00336 <span class="comment"> *            iterations returned non-zero</span>
00337 <span class="comment"> * @see apr_table_do_callback_fn_t</span>
00338 <span class="comment"> */</span>
00339 APR_DECLARE_NONSTD(<span class="keywordtype">int</span>) apr_table_do(apr_table_do_callback_fn_t *comp,
00340                                      <span class="keywordtype">void</span> *rec, const apr_table_t *t, ...);
00341 <span class="comment"></span>
00342 <span class="comment">/** </span>
00343 <span class="comment"> * Iterate over a table running the provided function once for every</span>
00344 <span class="comment"> * element in the table.  If there is data passed in as a vararg, then the </span>
00345 <span class="comment"> * function is only run on those element's whose key matches something in </span>
00346 <span class="comment"> * the vararg.  If the vararg is NULL, then every element is run through the</span>
00347 <span class="comment"> * function.  Iteration continues while the function returns non-zero.</span>
00348 <span class="comment"> * @param comp The function to run</span>
00349 <span class="comment"> * @param rec The data to pass as the first argument to the function</span>
00350 <span class="comment"> * @param t The table to iterate over</span>
00351 <span class="comment"> * @param vp The vararg table.  If this is NULL, then all elements in the </span>
00352 <span class="comment"> *                table are run through the function, otherwise only those </span>
00353 <span class="comment"> *                whose key matches are run.</span>
00354 <span class="comment"> * @return FALSE if one of the comp() iterations returned zero; TRUE if all</span>
00355 <span class="comment"> *            iterations returned non-zero</span>
00356 <span class="comment"> * @see apr_table_do_callback_fn_t</span>
00357 <span class="comment"> */</span>
00358 APR_DECLARE(<span class="keywordtype">int</span>) apr_table_vdo(apr_table_do_callback_fn_t *comp,
00359                                <span class="keywordtype">void</span> *rec, const apr_table_t *t, va_list vp);
00360 <span class="comment"></span>
00361 <span class="comment">/** flag for overlap to use apr_table_setn */</span>
<a name="l00362"></a><a class="code" href="group__apr__tables.html#ga31">00362</a> #define APR_OVERLAP_TABLES_SET   (0)<span class="comment"></span>
00363 <span class="comment">/** flag for overlap to use apr_table_mergen */</span>
<a name="l00364"></a><a class="code" href="group__apr__tables.html#ga32">00364</a> #define APR_OVERLAP_TABLES_MERGE (1)<span class="comment"></span>
00365 <span class="comment">/**</span>
00366 <span class="comment"> * For each element in table b, either use setn or mergen to add the data</span>
00367 <span class="comment"> * to table a.  Which method is used is determined by the flags passed in.</span>
00368 <span class="comment"> * @param a The table to add the data to.</span>
00369 <span class="comment"> * @param b The table to iterate over, adding its data to table a</span>
00370 <span class="comment"> * @param flags How to add the table to table a.  One of:</span>
00371 <span class="comment"> *          APR_OVERLAP_TABLES_SET        Use apr_table_setn</span>
00372 <span class="comment"> *          APR_OVERLAP_TABLES_MERGE      Use apr_table_mergen</span>
00373 <span class="comment"> * @remark  This function is highly optimized, and uses less memory and CPU cycles</span>
00374 <span class="comment"> *          than a function that just loops through table b calling other functions.</span>
00375 <span class="comment"> */</span><span class="comment"></span>
00376 <span class="comment">/**</span>
00377 <span class="comment"> *&lt;PRE&gt;</span>
00378 <span class="comment"> * Conceptually, apr_table_overlap does this:</span>
00379 <span class="comment"> *</span>
00380 <span class="comment"> *  apr_array_header_t *barr = apr_table_elts(b);</span>
00381 <span class="comment"> *  apr_table_entry_t *belt = (apr_table_entry_t *)barr-&gt;elts;</span>
00382 <span class="comment"> *  int i;</span>
00383 <span class="comment"> *</span>
00384 <span class="comment"> *  for (i = 0; i &lt; barr-&gt;nelts; ++i) {</span>
00385 <span class="comment"> *      if (flags &amp; APR_OVERLAP_TABLES_MERGE) {</span>
00386 <span class="comment"> *          apr_table_mergen(a, belt[i].key, belt[i].val);</span>
00387 <span class="comment"> *      }</span>
00388 <span class="comment"> *      else {</span>
00389 <span class="comment"> *          apr_table_setn(a, belt[i].key, belt[i].val);</span>
00390 <span class="comment"> *      }</span>
00391 <span class="comment"> *  }</span>
00392 <span class="comment"> *</span>
00393 <span class="comment"> *  Except that it is more efficient (less space and cpu-time) especially</span>
00394 <span class="comment"> *  when b has many elements.</span>
00395 <span class="comment"> *</span>
00396 <span class="comment"> *  Notice the assumptions on the keys and values in b -- they must be</span>
00397 <span class="comment"> *  in an ancestor of a's pool.  In practice b and a are usually from</span>
00398 <span class="comment"> *  the same pool.</span>
00399 <span class="comment"> * &lt;/PRE&gt;</span>
00400 <span class="comment"> */</span>
00401 
00402 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
00403                                      <span class="keywordtype">unsigned</span> flags);
00404 <span class="comment"></span>
00405 <span class="comment">/**</span>
00406 <span class="comment"> * Eliminate redundant entries in a table by either overwriting</span>
00407 <span class="comment"> * or merging duplicates</span>
00408 <span class="comment"> *</span>
00409 <span class="comment"> * @param t Table.</span>
00410 <span class="comment"> * @param flags APR_OVERLAP_TABLES_MERGE to merge, or</span>
00411 <span class="comment"> *              APR_OVERLAP_TABLES_SET to overwrite</span>
00412 <span class="comment"> */</span>
00413 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_compress(apr_table_t *t, <span class="keywordtype">unsigned</span> flags);
00414 <span class="comment"></span>
00415 <span class="comment">/** @} */</span>
00416 
00417 #ifdef __cplusplus
00418 }
00419 #endif
00420 
00421 #endif  <span class="comment">/* ! APR_TABLES_H */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:26 2005 for Apache Portable Runtime by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
</body>
</html>