⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apr__tables_8h-source.html

📁 apr函数库使用手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
00284 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_add(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00285                                 const <span class="keywordtype">char</span> *val);
00286 <span class="comment"></span>
00287 <span class="comment">/**</span>
00288 <span class="comment"> * Add data to a table, regardless of whether there is another element with the</span>
00289 <span class="comment"> * same key.</span>
00290 <span class="comment"> * @param t The table to add to</span>
00291 <span class="comment"> * @param key The key to use</span>
00292 <span class="comment"> * @param val The value to add.</span>
00293 <span class="comment"> * @remark When adding data, this function does not make a copy of the key or the</span>
00294 <span class="comment"> *         value, so care should be taken to ensure that the values will not </span>
00295 <span class="comment"> *         change after they have been added..</span>
00296 <span class="comment"> */</span>
00297 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_addn(apr_table_t *t, const <span class="keywordtype">char</span> *key,
00298                                  const <span class="keywordtype">char</span> *val);
00299 <span class="comment"></span>
00300 <span class="comment">/**</span>
00301 <span class="comment"> * Merge two tables into one new table</span>
00302 <span class="comment"> * @param p The pool to use for the new table</span>
00303 <span class="comment"> * @param overlay The first table to put in the new table</span>
00304 <span class="comment"> * @param base The table to add at the end of the new table</span>
00305 <span class="comment"> * @return A new table containing all of the data from the two passed in</span>
00306 <span class="comment"> */</span>
00307 APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p,
00308                                              const apr_table_t *overlay,
00309                                              const apr_table_t *base);
00310 <span class="comment"></span>
00311 <span class="comment">/**</span>
00312 <span class="comment"> * Declaration prototype for the iterator callback function of apr_table_do()</span>
00313 <span class="comment"> * and apr_table_vdo().</span>
00314 <span class="comment"> * @param rec The data passed as the first argument to apr_table_[v]do()</span>
00315 <span class="comment"> * @param key The key from this iteration of the table</span>
00316 <span class="comment"> * @param value The value from this iteration of the table</span>
00317 <span class="comment"> * @remark Iteration continues while this callback function returns non-zero.</span>
00318 <span class="comment"> * To export the callback function for apr_table_[v]do() it must be declared </span>
00319 <span class="comment"> * in the _NONSTD convention.</span>
00320 <span class="comment"> */</span>
<a name="l00321"></a><a class="code" href="group__apr__tables.html#ga3">00321</a> typedef <span class="keywordtype">int</span> (<a class="code" href="group__apr__tables.html#ga3">apr_table_do_callback_fn_t</a>)(<span class="keywordtype">void</span> *rec, const <span class="keywordtype">char</span> *key, 
00322                                                     const <span class="keywordtype">char</span> *value);
00323 <span class="comment"></span>
00324 <span class="comment">/** </span>
00325 <span class="comment"> * Iterate over a table running the provided function once for every</span>
00326 <span class="comment"> * element in the table.  If there is data passed in as a vararg, then the </span>
00327 <span class="comment"> * function is only run on those elements whose key matches something in </span>
00328 <span class="comment"> * the vararg.  If the vararg is NULL, then every element is run through the</span>
00329 <span class="comment"> * function.  Iteration continues while the function returns non-zero.</span>
00330 <span class="comment"> * @param comp The function to run</span>
00331 <span class="comment"> * @param rec The data to pass as the first argument to the function</span>
00332 <span class="comment"> * @param t The table to iterate over</span>
00333 <span class="comment"> * @param ... The vararg.  If this is NULL, then all elements in the table are</span>
00334 <span class="comment"> *            run through the function, otherwise only those whose key matches</span>
00335 <span class="comment"> *            are run.</span>
00336 <span class="comment"> * @return FALSE if one of the comp() iterations returned zero; TRUE if all</span>
00337 <span class="comment"> *            iterations returned non-zero</span>
00338 <span class="comment"> * @see apr_table_do_callback_fn_t</span>
00339 <span class="comment"> */</span>
00340 APR_DECLARE_NONSTD(<span class="keywordtype">int</span>) apr_table_do(apr_table_do_callback_fn_t *comp,
00341                                      <span class="keywordtype">void</span> *rec, const apr_table_t *t, ...);
00342 <span class="comment"></span>
00343 <span class="comment">/** </span>
00344 <span class="comment"> * Iterate over a table running the provided function once for every</span>
00345 <span class="comment"> * element in the table.  If there is data passed in as a vararg, then the </span>
00346 <span class="comment"> * function is only run on those element's whose key matches something in </span>
00347 <span class="comment"> * the vararg.  If the vararg is NULL, then every element is run through the</span>
00348 <span class="comment"> * function.  Iteration continues while the function returns non-zero.</span>
00349 <span class="comment"> * @param comp The function to run</span>
00350 <span class="comment"> * @param rec The data to pass as the first argument to the function</span>
00351 <span class="comment"> * @param t The table to iterate over</span>
00352 <span class="comment"> * @param vp The vararg table.  If this is NULL, then all elements in the </span>
00353 <span class="comment"> *                table are run through the function, otherwise only those </span>
00354 <span class="comment"> *                whose key matches are run.</span>
00355 <span class="comment"> * @return FALSE if one of the comp() iterations returned zero; TRUE if all</span>
00356 <span class="comment"> *            iterations returned non-zero</span>
00357 <span class="comment"> * @see apr_table_do_callback_fn_t</span>
00358 <span class="comment"> */</span>
00359 APR_DECLARE(<span class="keywordtype">int</span>) apr_table_vdo(apr_table_do_callback_fn_t *comp,
00360                                <span class="keywordtype">void</span> *rec, const apr_table_t *t, va_list vp);
00361 <span class="comment"></span>
00362 <span class="comment">/** flag for overlap to use apr_table_setn */</span>
<a name="l00363"></a><a class="code" href="group__apr__tables.html#ga31">00363</a> #define APR_OVERLAP_TABLES_SET   (0)<span class="comment"></span>
00364 <span class="comment">/** flag for overlap to use apr_table_mergen */</span>
<a name="l00365"></a><a class="code" href="group__apr__tables.html#ga32">00365</a> #define APR_OVERLAP_TABLES_MERGE (1)<span class="comment"></span>
00366 <span class="comment">/**</span>
00367 <span class="comment"> * For each element in table b, either use setn or mergen to add the data</span>
00368 <span class="comment"> * to table a.  Which method is used is determined by the flags passed in.</span>
00369 <span class="comment"> * @param a The table to add the data to.</span>
00370 <span class="comment"> * @param b The table to iterate over, adding its data to table a</span>
00371 <span class="comment"> * @param flags How to add the table to table a.  One of:</span>
00372 <span class="comment"> *          APR_OVERLAP_TABLES_SET        Use apr_table_setn</span>
00373 <span class="comment"> *          APR_OVERLAP_TABLES_MERGE      Use apr_table_mergen</span>
00374 <span class="comment"> * @remark  This function is highly optimized, and uses less memory and CPU cycles</span>
00375 <span class="comment"> *          than a function that just loops through table b calling other functions.</span>
00376 <span class="comment"> */</span><span class="comment"></span>
00377 <span class="comment">/**</span>
00378 <span class="comment"> *&lt;PRE&gt;</span>
00379 <span class="comment"> * Conceptually, apr_table_overlap does this:</span>
00380 <span class="comment"> *</span>
00381 <span class="comment"> *  apr_array_header_t *barr = apr_table_elts(b);</span>
00382 <span class="comment"> *  apr_table_entry_t *belt = (apr_table_entry_t *)barr-&gt;elts;</span>
00383 <span class="comment"> *  int i;</span>
00384 <span class="comment"> *</span>
00385 <span class="comment"> *  for (i = 0; i &lt; barr-&gt;nelts; ++i) {</span>
00386 <span class="comment"> *      if (flags &amp; APR_OVERLAP_TABLES_MERGE) {</span>
00387 <span class="comment"> *          apr_table_mergen(a, belt[i].key, belt[i].val);</span>
00388 <span class="comment"> *      }</span>
00389 <span class="comment"> *      else {</span>
00390 <span class="comment"> *          apr_table_setn(a, belt[i].key, belt[i].val);</span>
00391 <span class="comment"> *      }</span>
00392 <span class="comment"> *  }</span>
00393 <span class="comment"> *</span>
00394 <span class="comment"> *  Except that it is more efficient (less space and cpu-time) especially</span>
00395 <span class="comment"> *  when b has many elements.</span>
00396 <span class="comment"> *</span>
00397 <span class="comment"> *  Notice the assumptions on the keys and values in b -- they must be</span>
00398 <span class="comment"> *  in an ancestor of a's pool.  In practice b and a are usually from</span>
00399 <span class="comment"> *  the same pool.</span>
00400 <span class="comment"> * &lt;/PRE&gt;</span>
00401 <span class="comment"> */</span>
00402 
00403 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
00404                                      <span class="keywordtype">unsigned</span> flags);
00405 <span class="comment"></span>
00406 <span class="comment">/**</span>
00407 <span class="comment"> * Eliminate redundant entries in a table by either overwriting</span>
00408 <span class="comment"> * or merging duplicates</span>
00409 <span class="comment"> *</span>
00410 <span class="comment"> * @param t Table.</span>
00411 <span class="comment"> * @param flags APR_OVERLAP_TABLES_MERGE to merge, or</span>
00412 <span class="comment"> *              APR_OVERLAP_TABLES_SET to overwrite</span>
00413 <span class="comment"> */</span>
00414 APR_DECLARE(<span class="keywordtype">void</span>) apr_table_compress(apr_table_t *t, <span class="keywordtype">unsigned</span> flags);
00415 <span class="comment"></span>
00416 <span class="comment">/** @} */</span>
00417 
00418 #ifdef __cplusplus
00419 }
00420 #endif
00421 
00422 #endif  <span class="comment">/* ! APR_TABLES_H */</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 7 13:18:25 2005 for Apache Portable Runtime by
<a href="../../../www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -