Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_tables.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef APR_TABLES_H
00017 #define APR_TABLES_H
00018 
00024 #include "apr.h"
00025 #include "apr_pools.h"
00026 
00027 #if APR_HAVE_STDARG_H
00028 #include <stdarg.h>     /* for va_list */
00029 #endif
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif /* __cplusplus */
00034 
00045 typedef struct apr_table_t apr_table_t;
00046 
00048 typedef struct apr_array_header_t apr_array_header_t;
00049 
00051 struct apr_array_header_t {
00053     apr_pool_t *pool;
00055     int elt_size;
00057     int nelts;
00059     int nalloc;
00061     char *elts;
00062 };
00063 
00067 typedef struct apr_table_entry_t apr_table_entry_t;
00068 
00070 struct apr_table_entry_t {
00072     char *key;          /* maybe NULL in future;
00073                          * check when iterating thru table_elts
00074                          */
00076     char *val;
00077 
00079     apr_uint32_t key_checksum;
00080 };
00081 
00087 APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
00088 
00094 APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
00095 
00101 APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a);
00102 
00110 APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
00111                                                  int nelts, int elt_size);
00112 
00120 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00121 
00128 APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr);
00129 
00136 APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst,
00137                                 const apr_array_header_t *src);
00138 
00148 APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
00149                                       const apr_array_header_t *arr);
00158 APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p,
00159                                       const apr_array_header_t *arr);
00160 
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 
00183 APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p,
00184                                       const apr_array_header_t *arr,
00185                                       const char sep);
00186 
00194 APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts);
00195 
00202 APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
00203                                           const apr_table_t *t);
00204 
00209 APR_DECLARE(void) apr_table_clear(apr_table_t *t);
00210 
00218 APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);
00219 
00229 APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key,
00230                                 const char *val);
00231 
00242 APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key,
00243                                  const char *val);
00244 
00250 APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);
00251 
00260 APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key,
00261                                   const char *val);
00262 
00271 APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
00272                                    const char *val);
00273 
00283 APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key,
00284                                 const char *val);
00285 
00296 APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key,
00297                                  const char *val);
00298 
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 
00320 typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key, 
00321                                                     const char *value);
00322 
00339 APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
00340                                      void *rec, const apr_table_t *t, ...);
00341 
00358 APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
00359                                void *rec, const apr_table_t *t, va_list vp);
00360 
00362 #define APR_OVERLAP_TABLES_SET   (0)
00363 
00364 #define APR_OVERLAP_TABLES_MERGE (1)
00365 
00402 APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
00403                                      unsigned flags);
00404 
00413 APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags);
00414 
00417 #ifdef __cplusplus
00418 }
00419 #endif
00420 
00421 #endif  /* ! APR_TABLES_H */

Generated on Fri Apr 23 07:11:26 2004 for Apache Portable Runtime by doxygen 1.3.4