apr__hash_8h-source.html

来自「apr函数库使用手册」· HTML 代码 · 共 238 行 · 第 1/2 页

HTML
238
字号
<!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_hash.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_hash.h</h1><a href="apr__hash_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_HASH_H</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define APR_HASH_H</span>
00019 <span class="preprocessor"></span><span class="comment"></span>
00020 <span class="comment">/**</span>
00021 <span class="comment"> * @file apr_hash.h</span>
00022 <span class="comment"> * @brief APR Hash Tables</span>
00023 <span class="comment"> */</span>
00024 
00025 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00026 
00027 <span class="preprocessor">#ifdef __cplusplus</span>
00028 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00029 <span class="preprocessor">#endif</span>
00030 <span class="preprocessor"></span><span class="comment"></span>
00031 <span class="comment">/**</span>
00032 <span class="comment"> * @defgroup apr_hash Hash Tables</span>
00033 <span class="comment"> * @ingroup APR </span>
00034 <span class="comment"> * @{</span>
00035 <span class="comment"> */</span>
00036 <span class="comment"></span>
00037 <span class="comment">/**</span>
00038 <span class="comment"> * When passing a key to apr_hash_set or apr_hash_get, this value can be</span>
00039 <span class="comment"> * passed to indicate a string-valued key, and have apr_hash compute the</span>
00040 <span class="comment"> * length automatically.</span>
00041 <span class="comment"> *</span>
00042 <span class="comment"> * @remark apr_hash will use strlen(key) for the length. The NUL terminator</span>
00043 <span class="comment"> *         is not included in the hash value (why throw a constant in?).</span>
00044 <span class="comment"> *         Since the hash table merely references the provided key (rather</span>
00045 <span class="comment"> *         than copying it), apr_hash_this() will return the NUL-term'd key.</span>
00046 <span class="comment"> */</span>
<a name="l00047"></a><a class="code" href="group__apr__hash.html#ga16">00047</a> <span class="preprocessor">#define APR_HASH_KEY_STRING     (-1)</span>
00048 <span class="preprocessor"></span><span class="comment"></span>
00049 <span class="comment">/**</span>
00050 <span class="comment"> * Abstract type for hash tables.</span>
00051 <span class="comment"> */</span>
<a name="l00052"></a><a class="code" href="group__apr__hash.html#ga0">00052</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__hash.html#ga0">apr_hash_t</a> <a class="code" href="group__apr__hash.html#ga0">apr_hash_t</a>;
00053 <span class="comment"></span>
00054 <span class="comment">/**</span>
00055 <span class="comment"> * Abstract type for scanning hash tables.</span>
00056 <span class="comment"> */</span>
<a name="l00057"></a><a class="code" href="group__apr__hash.html#ga1">00057</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__hash.html#ga1">apr_hash_index_t</a> <a class="code" href="group__apr__hash.html#ga1">apr_hash_index_t</a>;
00058 <span class="comment"></span>
00059 <span class="comment">/**</span>
00060 <span class="comment"> * Callback functions for calculating hash values.</span>
00061 <span class="comment"> * @param key The key.</span>
00062 <span class="comment"> * @param klen The length of the key, or APR_HASH_KEY_STRING to use the string </span>
00063 <span class="comment"> *             length. If APR_HASH_KEY_STRING then returns the actual key length.</span>
00064 <span class="comment"> */</span>
<a name="l00065"></a><a class="code" href="group__apr__hash.html#ga2">00065</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> int (*<a class="code" href="group__apr__hash.html#ga2">apr_hashfunc_t</a>)(<span class="keyword">const</span> <span class="keywordtype">char</span> *key, apr_ssize_t *klen);
00066 <span class="comment"></span>
00067 <span class="comment">/**</span>
00068 <span class="comment"> * The default hash function.</span>
00069 <span class="comment"> */</span>
00070 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="group__apr__hash.html#ga3">apr_hashfunc_default</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *key, apr_ssize_t *klen);
00071 <span class="comment"></span>
00072 <span class="comment">/**</span>
00073 <span class="comment"> * Create a hash table.</span>
00074 <span class="comment"> * @param pool The pool to allocate the hash table out of</span>
00075 <span class="comment"> * @return The hash table just created</span>
00076 <span class="comment">  */</span>
00077 APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool);
00078 <span class="comment"></span>
00079 <span class="comment">/**</span>
00080 <span class="comment"> * Create a hash table with a custom hash function</span>
00081 <span class="comment"> * @param pool The pool to allocate the hash table out of</span>
00082 <span class="comment"> * @param hash_func A custom hash function.</span>
00083 <span class="comment"> * @return The hash table just created</span>
00084 <span class="comment">  */</span>
00085 APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool, 
00086                                                apr_hashfunc_t hash_func);
00087 <span class="comment"></span>
00088 <span class="comment">/**</span>
00089 <span class="comment"> * Make a copy of a hash table</span>
00090 <span class="comment"> * @param pool The pool from which to allocate the new hash table</span>
00091 <span class="comment"> * @param h The hash table to clone</span>
00092 <span class="comment"> * @return The hash table just created</span>
00093 <span class="comment"> * @remark Makes a shallow copy</span>
00094 <span class="comment"> */</span>
00095 APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool,
00096                                         const apr_hash_t *h);
00097 <span class="comment"></span>
00098 <span class="comment">/**</span>
00099 <span class="comment"> * Associate a value with a key in a hash table.</span>
00100 <span class="comment"> * @param ht The hash table</span>
00101 <span class="comment"> * @param key Pointer to the key</span>
00102 <span class="comment"> * @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.</span>
00103 <span class="comment"> * @param val Value to associate with the key</span>
00104 <span class="comment"> * @remark If the value is NULL the hash entry is deleted.</span>
00105 <span class="comment"> */</span>
00106 APR_DECLARE(<span class="keywordtype">void</span>) apr_hash_set(apr_hash_t *ht, const <span class="keywordtype">void</span> *key,
00107                                apr_ssize_t klen, const <span class="keywordtype">void</span> *val);
00108 <span class="comment"></span>
00109 <span class="comment">/**</span>
00110 <span class="comment"> * Look up the value associated with a key in a hash table.</span>
00111 <span class="comment"> * @param ht The hash table</span>
00112 <span class="comment"> * @param key Pointer to the key</span>

⌨️ 快捷键说明

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