GME  13
apr_hash.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_HASH_H
00018 #define APR_HASH_H
00019 
00025 #include "apr_pools.h"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00047 #define APR_HASH_KEY_STRING     (-1)
00048 
00052 typedef struct apr_hash_t apr_hash_t;
00053 
00057 typedef struct apr_hash_index_t apr_hash_index_t;
00058 
00065 typedef unsigned int (*apr_hashfunc_t)(const char *key, apr_ssize_t *klen);
00066 
00070 APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *key,
00071                                                       apr_ssize_t *klen);
00072 
00078 APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool);
00079 
00086 APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool, 
00087                                                apr_hashfunc_t hash_func);
00088 
00096 APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool,
00097                                         const apr_hash_t *h);
00098 
00107 APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, const void *key,
00108                                apr_ssize_t klen, const void *val);
00109 
00117 APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, const void *key,
00118                                  apr_ssize_t klen);
00119 
00147 APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht);
00148 
00155 APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi);
00156 
00166 APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key, 
00167                                 apr_ssize_t *klen, void **val);
00168 
00174 APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht);
00175 
00180 APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht);
00181 
00191 APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p,
00192                                            const apr_hash_t *overlay, 
00193                                            const apr_hash_t *base);
00194 
00209 APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p,
00210                                          const apr_hash_t *h1,
00211                                          const apr_hash_t *h2,
00212                                          void * (*merger)(apr_pool_t *p,
00213                                                      const void *key,
00214                                                      apr_ssize_t klen,
00215                                                      const void *h1_val,
00216                                                      const void *h2_val,
00217                                                      const void *data),
00218                                          const void *data);
00219 
00231 typedef int (apr_hash_do_callback_fn_t)(void *rec, const void *key,
00232                                                    apr_ssize_t klen,
00233                                                    const void *value);
00234 
00247 APR_DECLARE(int) apr_hash_do(apr_hash_do_callback_fn_t *comp,
00248                              void *rec, const apr_hash_t *ht);
00249 
00253 APR_POOL_DECLARE_ACCESSOR(hash);
00254 
00257 #ifdef __cplusplus
00258 }
00259 #endif
00260 
00261 #endif  /* !APR_HASH_H */