GME
13
|
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 00056 typedef struct apr_table_t apr_table_t; 00057 00059 typedef struct apr_array_header_t apr_array_header_t; 00060 00062 struct apr_array_header_t { 00064 apr_pool_t *pool; 00066 int elt_size; 00068 int nelts; 00070 int nalloc; 00072 char *elts; 00073 }; 00074 00078 typedef struct apr_table_entry_t apr_table_entry_t; 00079 00081 struct apr_table_entry_t { 00083 char *key; /* maybe NULL in future; 00084 * check when iterating thru table_elts 00085 */ 00087 char *val; 00088 00090 apr_uint32_t key_checksum; 00091 }; 00092 00098 APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t); 00099 00105 APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t); 00106 00112 APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a); 00113 00121 APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p, 00122 int nelts, int elt_size); 00123 00131 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr); 00132 00141 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i]) 00142 00150 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary))) 00151 00158 APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr); 00159 00166 APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr); 00167 00174 APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst, 00175 const apr_array_header_t *src); 00176 00186 APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p, 00187 const apr_array_header_t *arr); 00196 APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p, 00197 const apr_array_header_t *arr); 00198 00206 APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p, 00207 const apr_array_header_t *first, 00208 const apr_array_header_t *second); 00209 00221 APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p, 00222 const apr_array_header_t *arr, 00223 const char sep); 00224 00232 APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts); 00233 00241 APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p, 00242 const apr_table_t *t); 00243 00252 APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p, 00253 const apr_table_t *t); 00254 00259 APR_DECLARE(void) apr_table_clear(apr_table_t *t); 00260 00268 APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key); 00269 00279 APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, 00280 const char *val); 00281 00292 APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, 00293 const char *val); 00294 00300 APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key); 00301 00311 APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key, 00312 const char *val); 00313 00323 APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key, 00324 const char *val); 00325 00335 APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key, 00336 const char *val); 00337 00348 APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key, 00349 const char *val); 00350 00358 APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, 00359 const apr_table_t *overlay, 00360 const apr_table_t *base); 00361 00372 typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key, 00373 const char *value); 00374 00394 APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp, 00395 void *rec, const apr_table_t *t, ...) 00396 #if defined(__GNUC__) && __GNUC__ >= 4 00397 __attribute__((sentinel)) 00398 #endif 00399 ; 00400 00420 APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp, 00421 void *rec, const apr_table_t *t, va_list vp); 00422 00424 #define APR_OVERLAP_TABLES_SET (0) 00425 00426 #define APR_OVERLAP_TABLES_MERGE (1) 00427 00466 APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, 00467 unsigned flags); 00468 00479 APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags); 00480 00483 #ifdef __cplusplus 00484 } 00485 #endif 00486 00487 #endif /* ! APR_TABLES_H */