Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_tables.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APR_TABLES_H
18 #define APR_TABLES_H
19 
25 #include "apr.h"
26 #include "apr_pools.h"
27 
28 #if APR_HAVE_STDARG_H
29 #include <stdarg.h> /* for va_list */
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35 
56 typedef struct apr_table_t apr_table_t;
57 
60 
66  int elt_size;
68  int nelts;
70  int nalloc;
72  char *elts;
73 };
74 
79 
83  char *key; /* maybe NULL in future;
84  * check when iterating thru table_elts
85  */
87  char *val;
88 
91 };
92 
99 
106 
113 
122  int nelts, int elt_size);
123 
132 
141 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
142 
150 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
151 
159 
167 
175  const apr_array_header_t *src);
176 
187  const apr_array_header_t *arr);
197  const apr_array_header_t *arr);
198 
207  const apr_array_header_t *first,
208  const apr_array_header_t *second);
209 
222  const apr_array_header_t *arr,
223  const char sep);
224 
233 
242  const apr_table_t *t);
243 
253  const apr_table_t *t);
254 
260 
268 APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);
269 
279 APR_DECLARE(const char *) apr_table_getm(apr_pool_t *p, const apr_table_t *t,
280  const char *key);
281 
291 APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key,
292  const char *val);
293 
304 APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key,
305  const char *val);
306 
312 APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);
313 
323 APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key,
324  const char *val);
325 
335 APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
336  const char *val);
337 
347 APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key,
348  const char *val);
349 
360 APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key,
361  const char *val);
362 
371  const apr_table_t *overlay,
372  const apr_table_t *base);
373 
384 typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key,
385  const char *value);
386 
407  void *rec, const apr_table_t *t, ...)
408 #if defined(__GNUC__) && __GNUC__ >= 4
409  __attribute__((sentinel))
410 #endif
411  ;
412 
433  void *rec, const apr_table_t *t, va_list vp);
434 
436 #define APR_OVERLAP_TABLES_SET (0)
437 
438 #define APR_OVERLAP_TABLES_MERGE (1)
439 
440 #define APR_OVERLAP_TABLES_ADD (2)
441 
485  unsigned flags);
486 
498 APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags);
499 
502 #ifdef __cplusplus
503 }
504 #endif
505 
506 #endif /* ! APR_TABLES_H */
apr_table_t * apr_table_copy(apr_pool_t *p, const apr_table_t *t)
apr_table_t * apr_table_make(apr_pool_t *p, int nelts)
Definition: apr_tables.h:62
apr_array_header_t * apr_array_make(apr_pool_t *p, int nelts, int elt_size)
apr_array_header_t * apr_array_copy(apr_pool_t *p, const apr_array_header_t *arr)
apr_status_t __attribute__((nonnull(1)))
int apr_is_empty_array(const apr_array_header_t *a)
int nalloc
Definition: apr_tables.h:70
void apr_array_cat(apr_array_header_t *dst, const apr_array_header_t *src)
void apr_table_setn(apr_table_t *t, const char *key, const char *val)
void apr_table_add(apr_table_t *t, const char *key, const char *val)
#define APR_DECLARE_NONSTD(x)
Definition: macros.h:7
void apr_table_overlap(apr_table_t *a, const apr_table_t *b, unsigned flags)
void apr_table_unset(apr_table_t *t, const char *key)
int nelts
Definition: apr_tables.h:68
void * apr_array_push(apr_array_header_t *arr)
int apr_table_do(apr_table_do_callback_fn_t *comp, void *rec, const apr_table_t *t,...)
void apr_table_mergen(apr_table_t *t, const char *key, const char *val)
void apr_table_merge(apr_table_t *t, const char *key, const char *val)
char * key
Definition: apr_tables.h:83
apr_array_header_t * apr_array_copy_hdr(apr_pool_t *p, const apr_array_header_t *arr)
APR memory allocation.
void * apr_array_pop(apr_array_header_t *arr)
dav_error * src
Definition: mod_dav.h:186
int apr_table_vdo(apr_table_do_callback_fn_t *comp, void *rec, const apr_table_t *t, va_list vp)
int( apr_table_do_callback_fn_t)(void *rec, const char *key, const char *value)
Definition: apr_tables.h:384
apr_uint32_t key_checksum
Definition: apr_tables.h:90
Definition: apr_tables.h:81
int dav_response * first
Definition: mod_dav.h:574
const char * apr_table_get(const apr_table_t *t, const char *key)
unsigned int apr_uint32_t
Definition: apr.h:334
apr_array_header_t * apr_array_append(apr_pool_t *p, const apr_array_header_t *first, const apr_array_header_t *second)
APR Platform Definitions.
apr_table_t * apr_table_overlay(apr_pool_t *p, const apr_table_t *overlay, const apr_table_t *base)
int elt_size
Definition: apr_tables.h:66
void apr_table_clear(apr_table_t *t)
const apr_array_header_t * apr_table_elts(const apr_table_t *t)
apr_pool_t * p
#define APR_DECLARE(x)
Definition: macros.h:6
const char * apr_table_getm(apr_pool_t *p, const apr_table_t *t, const char *key)
apr_pool_t * pool
Definition: apr_tables.h:64
char * val
Definition: apr_tables.h:87
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
void apr_table_addn(apr_table_t *t, const char *key, const char *val)
void apr_table_set(apr_table_t *t, const char *key, const char *val)
char * elts
Definition: apr_tables.h:72
char * apr_array_pstrcat(apr_pool_t *p, const apr_array_header_t *arr, const char sep)
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1350
void apr_table_compress(apr_table_t *t, unsigned flags)
apr_table_t * apr_table_clone(apr_pool_t *p, const apr_table_t *t)
int apr_is_empty_table(const apr_table_t *t)
void apr_array_clear(apr_array_header_t *arr)