00001 /* Copyright 2005-2006 Garrett Rooney. 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 /** 00017 * @file etl_template.h 00018 * @brief Functions for manipulating ETL template files 00019 */ 00020 00021 #ifndef ETL_TEMPLATE_H 00022 #define ETL_TEMPLATE_H 00023 00024 #include <apr.h> 00025 #include <apr_hash.h> 00026 #include <apr_tables.h> 00027 #include <apr_buckets.h> 00028 00029 #include "etl_error.h" 00030 #include "etl_resolver.h" 00031 00032 #define ETL_TEMPLATE_MAJOR_VERSION 0 00033 #define ETL_TEMPLATE_MINOR_VERSION 1 00034 #define ETL_TEMPLATE_PATCH_VERSION 0 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif /* __cplusplus */ 00039 00040 /** A parsed template. */ 00041 typedef struct etl_template_t etl_template_t; 00042 00043 /** 00044 * Parse a bucket brigade @a input that contains ETL Template Language. 00045 * 00046 * Return a template in @a *tmpl, allocated in @a pool. 00047 */ 00048 etl_error_t * 00049 etl_template_parse(etl_template_t **tmpl, 00050 apr_bucket_brigade *input, 00051 apr_pool_t *pool); 00052 00053 /** 00054 * Parse a file @a fname, which contains ETL Template Language, returning 00055 * it in @a *tmpl and allocating it in @a pool. 00056 */ 00057 etl_error_t * 00058 etl_template_parse_file(etl_template_t **tmpl, 00059 const char *fname, 00060 apr_pool_t *pool); 00061 00062 /** 00063 * Execute @a tmpl in the context of @a environment sending output to 00064 * @a out and using @a pool for temporary allocations. 00065 * 00066 * @a resolver is used to find included templates. 00067 * 00068 * @a environment is a hash mapping <tt>char *</tt>'s to 00069 * @c etl_template_variable_t's. 00070 */ 00071 etl_error_t * 00072 etl_template_execute(etl_template_t *tmpl, 00073 etl_resolver_t *resolver, 00074 apr_hash_t *environment, 00075 apr_bucket_brigade *out, 00076 apr_pool_t *pool); 00077 00078 #ifdef __cplusplus 00079 } 00080 #endif /* __cplusplus */ 00081 00082 #endif /* ETL_TEMPLATE_H */
1.4.4