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

📄 apr__tables_8h-source.html

📁 apr函数库使用手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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.7 -->
<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>
<h1>apr_tables.h</h1><a href="apr__tables_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span>
00002 <span class="comment"> * applicable.</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00006 <span class="comment"> * You may obtain a copy of the License at</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
00009 <span class="comment"> *</span>
00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
00014 <span class="comment"> * limitations under the License.</span>
00015 <span class="comment"> */</span>
00016 
00017 <span class="preprocessor">#ifndef APR_TABLES_H</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define APR_TABLES_H</span>
00019 <span class="preprocessor"></span><span class="comment"></span>
00020 <span class="comment">/**</span>
00021 <span class="comment"> * @file apr_tables.h</span>
00022 <span class="comment"> * @brief APR Table library</span>
00023 <span class="comment"> */</span>
00024 
00025 <span class="preprocessor">#include "apr.h"</span>
00026 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00027 
00028 <span class="preprocessor">#if APR_HAVE_STDARG_H</span>
00029 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdarg.h&gt;</span>     <span class="comment">/* for va_list */</span>
00030 <span class="preprocessor">#endif</span>
00031 <span class="preprocessor"></span>
00032 <span class="preprocessor">#ifdef __cplusplus</span>
00033 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00034 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00035 <span class="comment"></span>
00036 <span class="comment">/**</span>
00037 <span class="comment"> * @defgroup apr_tables Table and Array Functions</span>
00038 <span class="comment"> * @ingroup APR </span>
00039 <span class="comment"> * Tables are used to store entirely opaque structures </span>
00040 <span class="comment"> * for applications, while Arrays are usually used to</span>
00041 <span class="comment"> * deal with string lists.</span>
00042 <span class="comment"> * @{</span>
00043 <span class="comment"> */</span>
00044 <span class="comment"></span>
00045 <span class="comment">/** the table abstract data type */</span>
<a name="l00046"></a><a class="code" href="group__apr__tables.html#ga0">00046</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>;
00047 <span class="comment"></span>
00048 <span class="comment">/** @see apr_array_header_t */</span>
<a name="l00049"></a><a class="code" href="group__apr__tables.html#ga1">00049</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>;
00050 <span class="comment"></span>
00051 <span class="comment">/** An opaque array type */</span>
<a name="l00052"></a><a class="code" href="structapr__array__header__t.html">00052</a> <span class="keyword">struct </span><a class="code" href="group__apr__tables.html#ga1">apr_array_header_t</a> {<span class="comment"></span>
00053 <span class="comment">    /** The pool the array is allocated out of */</span>
<a name="l00054"></a><a class="code" href="structapr__array__header__t.html#o0">00054</a>     <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *<a class="code" href="structapr__array__header__t.html#o0">pool</a>;<span class="comment"></span>
00055 <span class="comment">    /** The amount of memory allocated for each element of the array */</span>
<a name="l00056"></a><a class="code" href="structapr__array__header__t.html#o1">00056</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__array__header__t.html#o1">elt_size</a>;<span class="comment"></span>
00057 <span class="comment">    /** The number of active elements in the array */</span>
<a name="l00058"></a><a class="code" href="structapr__array__header__t.html#o2">00058</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__array__header__t.html#o2">nelts</a>;<span class="comment"></span>
00059 <span class="comment">    /** The number of elements allocated in the array */</span>
<a name="l00060"></a><a class="code" href="structapr__array__header__t.html#o3">00060</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__array__header__t.html#o3">nalloc</a>;<span class="comment"></span>
00061 <span class="comment">    /** The elements in the array */</span>
<a name="l00062"></a><a class="code" href="structapr__array__header__t.html#o4">00062</a>     <span class="keywordtype">char</span> *<a class="code" href="structapr__array__header__t.html#o4">elts</a>;
00063 };
00064 <span class="comment"></span>
00065 <span class="comment">/**</span>
00066 <span class="comment"> * The (opaque) structure for string-content tables.</span>
00067 <span class="comment"> */</span>
<a name="l00068"></a><a class="code" href="group__apr__tables.html#ga2">00068</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>;
00069 <span class="comment"></span>
00070 <span class="comment">/** The type for each entry in a string-content table */</span>
<a name="l00071"></a><a class="code" href="structapr__table__entry__t.html">00071</a> <span class="keyword">struct </span><a class="code" href="group__apr__tables.html#ga2">apr_table_entry_t</a> {<span class="comment"></span>
00072 <span class="comment">    /** The key for the current table entry */</span>
<a name="l00073"></a><a class="code" href="structapr__table__entry__t.html#o0">00073</a>     <span class="keywordtype">char</span> *<a class="code" href="structapr__table__entry__t.html#o0">key</a>;          <span class="comment">/* maybe NULL in future;</span>
00074 <span class="comment">                         * check when iterating thru table_elts</span>
00075 <span class="comment">                         */</span><span class="comment"></span>
00076 <span class="comment">    /** The value for the current table entry */</span>
<a name="l00077"></a><a class="code" href="structapr__table__entry__t.html#o1">00077</a>     <span class="keywordtype">char</span> *<a class="code" href="structapr__table__entry__t.html#o1">val</a>;
00078 <span class="comment"></span>
00079 <span class="comment">    /** A checksum for the key, for use by the apr_table internals */</span>
<a name="l00080"></a><a class="code" href="structapr__table__entry__t.html#o2">00080</a>     apr_uint32_t <a class="code" href="structapr__table__entry__t.html#o2">key_checksum</a>;
00081 };
00082 <span class="comment"></span>
00083 <span class="comment">/**</span>
00084 <span class="comment"> * Get the elements from a table</span>
00085 <span class="comment"> * @param t The table</span>
00086 <span class="comment"> * @return An array containing the contents of the table</span>
00087 <span class="comment"> */</span>
00088 APR_DECLARE(<span class="keyword">const</span> apr_array_header_t *) apr_table_elts(const apr_table_t *t);
00089 <span class="comment"></span>
00090 <span class="comment">/**</span>
00091 <span class="comment"> * Determine if the table is empty</span>
00092 <span class="comment"> * @param t The table to check</span>
00093 <span class="comment"> * @return True if empty, False otherwise</span>
00094 <span class="comment"> */</span>
00095 APR_DECLARE(<span class="keywordtype">int</span>) apr_is_empty_table(const apr_table_t *t);
00096 <span class="comment"></span>
00097 <span class="comment">/**</span>
00098 <span class="comment"> * Determine if the array is empty</span>
00099 <span class="comment"> * @param a The array to check</span>
00100 <span class="comment"> * @return True if empty, False otherwise</span>
00101 <span class="comment"> */</span>
00102 APR_DECLARE(<span class="keywordtype">int</span>) apr_is_empty_array(const apr_array_header_t *a);
00103 <span class="comment"></span>
00104 <span class="comment">/**</span>
00105 <span class="comment"> * Create an array</span>
00106 <span class="comment"> * @param p The pool to allocate the memory out of</span>
00107 <span class="comment"> * @param nelts the number of elements in the initial array</span>
00108 <span class="comment"> * @param elt_size The size of each element in the array.</span>
00109 <span class="comment"> * @return The new array</span>
00110 <span class="comment"> */</span>
00111 APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
00112                                                  <span class="keywordtype">int</span> nelts, <span class="keywordtype">int</span> elt_size);
00113 <span class="comment"></span>
00114 <span class="comment">/**</span>
00115 <span class="comment"> * Add a new element to an array (as a first-in, last-out stack)</span>
00116 <span class="comment"> * @param arr The array to add an element to.</span>
00117 <span class="comment"> * @return Location for the new element in the array.</span>
00118 <span class="comment"> * @remark If there are no free spots in the array, then this function will</span>
00119 <span class="comment"> *         allocate new space for the new element.</span>
00120 <span class="comment"> */</span>
00121 APR_DECLARE(<span class="keywordtype">void</span> *) apr_array_push(apr_array_header_t *arr);
00122 <span class="comment"></span>
00123 <span class="comment">/**</span>
00124 <span class="comment"> * Remove an element from an array (as a first-in, last-out stack)</span>
00125 <span class="comment"> * @param arr The array to remove an element from.</span>
00126 <span class="comment"> * @return Location of the element in the array.</span>
00127 <span class="comment"> * @remark If there are no elements in the array, NULL is returned.</span>
00128 <span class="comment"> */</span>
00129 APR_DECLARE(<span class="keywordtype">void</span> *) apr_array_pop(apr_array_header_t *arr);
00130 <span class="comment"></span>
00131 <span class="comment">/**</span>
00132 <span class="comment"> * Concatenate two arrays together</span>
00133 <span class="comment"> * @param dst The destination array, and the one to go first in the combined </span>
00134 <span class="comment"> *            array</span>
00135 <span class="comment"> * @param src The source array to add to the destination array</span>
00136 <span class="comment"> */</span>
00137 APR_DECLARE(<span class="keywordtype">void</span>) apr_array_cat(apr_array_header_t *dst,
00138                                 const apr_array_header_t *src);

⌨️ 快捷键说明

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