• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files

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 
00020 /**
00021  * @file apr_tables.h
00022  * @brief APR Table library
00023  */
00024 
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 
00036 /**
00037  * @defgroup apr_tables Table and Array Functions
00038  * @ingroup APR 
00039  * Tables are used to store entirely opaque structures 
00040  * for applications, while Arrays are usually used to
00041  * deal with string lists.
00042  * @{
00043  */
00044 
00045 /** the table abstract data type */
00046 typedef struct apr_table_t apr_table_t;
00047 
00048 /** @see apr_array_header_t */
00049 typedef struct apr_array_header_t apr_array_header_t;
00050 
00051 /** An opaque array type */
00052 struct apr_array_header_t {
00053     /** The pool the array is allocated out of */
00054     apr_pool_t *pool;
00055     /** The amount of memory allocated for each element of the array */
00056     int elt_size;
00057     /** The number of active elements in the array */
00058     int nelts;
00059     /** The number of elements allocated in the array */
00060     int nalloc;
00061     /** The elements in the array */
00062     char *elts;
00063 };
00064 
00065 /**
00066  * The (opaque) structure for string-content tables.
00067  */
00068 typedef struct apr_table_entry_t apr_table_entry_t;
00069 
00070 /** The type for each entry in a string-content table */
00071 struct apr_table_entry_t {
00072     /** The key for the current table entry */
00073     char *key;          /* maybe NULL in future;
00074                          * check when iterating thru table_elts
00075                          */
00076     /** The value for the current table entry */
00077     char *val;
00078 
00079     /** A checksum for the key, for use by the apr_table internals */
00080     apr_uint32_t key_checksum;
00081 };
00082 
00083 /**
00084  * Get the elements from a table
00085  * @param t The table
00086  * @return An array containing the contents of the table
00087  */
00088 APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
00089 
00090 /**
00091  * Determine if the table is empty
00092  * @param t The table to check
00093  * @return True if empty, False otherwise
00094  */
00095 APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
00096 
00097 /**
00098  * Determine if the array is empty
00099  * @param a The array to check
00100  * @return True if empty, False otherwise
00101  */
00102 APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a);
00103 
00104 /**
00105  * Create an array
00106  * @param p The pool to allocate the memory out of
00107  * @param nelts the number of elements in the initial array
00108  * @param elt_size The size of each element in the array.
00109  * @return The new array
00110  */
00111 APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
00112                                                  int nelts, int elt_size);
00113 
00114 /**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
00125t">/**
00115  * Add a new element to an array (as a first-in, last-out stack)
00116  * @param arr The array to add an element to.
00117  * @return Location for the new element in the array.
00118  * @remark If there are no free spots in the array, then this function will
00119  *         allocate new space for the new element.
00120  */
00121 APR_DECLARE(v