/* Copyright 2005-2006 Garrett Rooney. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file etl_template.h * @brief Functions for manipulating ETL template files */ #ifndef ETL_TEMPLATE_H #define ETL_TEMPLATE_H #include "etl_error.h" #include "etl_resolver.h" #include "etl_stream.h" #include "etl_hash.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** A parsed template. */ typedef struct etl_template_t etl_template_t; /** * Parse a stream @a input that contains ETL Template Language. * * Return a template in @a *tmpl. */ etl_error_t * etl_template_parse(etl_template_t **tmpl, etl_stream_t *input); /** * Parse a file @a fname, which contains ETL Template Language, returning * it in @a *tmpl. */ etl_error_t * etl_template_parse_file(etl_template_t **tmpl, const char *fname); /** * Execute @a tmpl in the context of @a environment sending output to * @a out. * * @a resolver is used to find included templates. * * @a environment is a hash mapping char *'s to * @c etl_template_variable_t's. */ etl_error_t * etl_template_execute(etl_template_t *tmpl, etl_resolver_t *resolver, etl_hash_t *environment, etl_stream_t *out); /** Destroy @a tmpl. */ void etl_template_destroy(etl_template_t *tmpl); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* ETL_TEMPLATE_H */