apr_tables.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_TABLES_H
00018 #define APR_TABLES_H
00019 
00025 #include "apr.h"
00026 #include "apr_pools.h"
00027 
00028 #if APR_HAVE_STDARG_H
00029 #include <stdarg.h>     /* for va_list */
00030 #endif
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif /* __cplusplus */
00035 
00046 typedef struct apr_table_t apr_table_t;
00047 
00049 typedef struct apr_array_header_t apr_array_header_t;
00050 
00052 struct apr_array_header_t {
00054     apr_pool_t *pool;
00056     int elt_size;
00058     int nelts;
00060     int nalloc;
00062     char *elts;
00063 };
00064 
00068 typedef struct apr_table_entry_t apr_table_entry_t;
00069 
00071 struct apr_table_entry_t {
00073     char *key;          /* maybe NULL in future;
00074                          * check when iterating thru table_elts
00075                          */
00077     char *val;
00078 
00080     apr_uint32_t key_checksum;
00081 };
00082 
00088 APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
00089 
00095 APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
00096 
00102 APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a);
00103 
00111 APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
00112                                                  int nelts, int elt_size);
00113 
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00122 
00129 APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr);
00130 
00137 APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst,
00138                                 const apr_array_header_t *src);
00139 
00149 APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
00150                                       const apr_array_header_t *arr);
00159 APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p,
00160                                       const apr_array_header_t *arr);
00161 
00169 APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p,
00170                                       const apr_array_header_t *first,
00171                                       const apr_array_header_t *second);
00172 
00184 APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p,
00185                                       const apr_array_header_t *arr,
00186                                       const char sep);
00187 
00195 APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts);
00196 
00203 APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
00204                                           const apr_table_t *t);
00205 
00210 APR_DECLARE(void) apr_table_clear(apr_table_t *t);
00211 
00219 APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);
00220 
00230 APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key,
00231                                 const char *val);
00232 
00243 APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key,
00244                                  const char *val);
00245 
00251 APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);
00252 
00261 APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key,
00262                                   const char *val);
00263 
00272 APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
00273                                    const char *val);
00274 
00284 APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key,
00285                                 const char *val);
00286 
00297 APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key,
00298                                  const char *val);
00299 
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 
00321 typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key, 
00322                                                     const char *value);
00323 
00340 APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
00341                                      void *rec, const apr_table_t *t, ...);
00342 
00359 APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
00360                                void *rec, const apr_table_t *t, va_list vp);
00361 
00363 #define APR_OVERLAP_TABLES_SET   (0)
00364 
00365 #define APR_OVERLAP_TABLES_MERGE (1)
00366 
00403 APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
00404                                      unsigned flags);
00405 
00414 APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags);
00415 
00418 #ifdef __cplusplus
00419 }
00420 #endif
00421 
00422 #endif  /* ! APR_TABLES_H */

Generated on Mon Nov 26 11:47:26 2007 for Apache Portable Runtime by  doxygen 1.5.2