Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

template.h File Reference

the template function prototypes More...

Go to the source code of this file.

Data Structures

struct  s_cf_template
struct  s_cf_tpl_variable

Typedefs

typedef s_cf_template t_cf_template
typedef s_cf_tpl_variable t_cf_tpl_variable
typedef void(* t_parse )(t_cf_template *)
typedef void(* t_parse_mem )(t_cf_template *)

Functions

int tpl_cf_init (t_cf_template *tpl, const u_char *fname)
void tpl_cf_setvar (t_cf_template *tpl, u_char *vname, const u_char *value, int len, int escapehtml)
int tpl_cf_appendvar (t_cf_template *tpl, u_char *vname, const u_char *value, int len)
void tpl_cf_freevar (t_cf_template *tpl, u_char *vname)
void tpl_cf_parse (t_cf_template *tpl)
void tpl_cf_parse_to_mem (t_cf_template *tpl)
void tpl_cf_finish (t_cf_template *tpl)
const t_cf_tpl_variabletpl_cf_getvar (t_cf_template *tpl, u_char *vname)


Detailed Description

the template function prototypes

Author:
Christian Kruse, <cjk@wwwtech.de>
This template library supports recursive ifs and variables. The template files will be transformed to C code and compiled to shared library files. These files will be bound to the program at runtime by dlopen(). This is *very* fast.

Definition in file template.h.


Typedef Documentation

typedef struct s_cf_template t_cf_template
 

This struct contains the necessary information about the template file.

typedef struct s_cf_tpl_variable t_cf_tpl_variable
 

This structure defines a variable value

typedef void(* t_parse)(t_cf_template *)
 

This is the function type called when parsing (tpl_parse) a template file

Definition at line 43 of file template.h.

typedef void(* t_parse_mem)(t_cf_template *)
 

This is the function type called when parsing (tpl_pars_to_mem) a template file

Definition at line 44 of file template.h.


Function Documentation

int tpl_cf_appendvar t_cf_template tpl,
u_char *  vname,
const u_char *  value,
int  len
 

This function appends a string to the value of the specified variable.

Parameters:
tpl The template structure
vname The variable name
value The value to append
len The length of the value
Returns:
0 on success, -1 on error

Definition at line 104 of file template.c.

void tpl_cf_finish t_cf_template tpl  ) 
 

This function destroys a template file structure. It closes the template file, frees the parsed content and destroys the variables.

Parameters:
tpl The template file structure

Definition at line 171 of file template.c.

void tpl_cf_freevar t_cf_template tpl,
u_char *  vname
 

This function unsets a template variable.

Parameters:
tpl The template file structure
vname The variable name

Definition at line 124 of file template.c.

const t_cf_tpl_variable* tpl_cf_getvar t_cf_template tpl,
u_char *  vname
 

This function returns the value of a template variable.

Parameters:
tpl The template file structure
vname The variable name
Returns:
The value of the variable if the variable could be found or NULL
Attention:
You may not free this value! It's done internally by the template engine!

Definition at line 187 of file template.c.

int tpl_cf_init t_cf_template tpl,
const u_char *  fname
 

This function loads a template file and initializes the template structure.

Parameters:
tpl The template structure
fname The filename of the template file. It has to contain the full path!
Returns:
0 on success, -1 on error

Definition at line 58 of file template.c.

void tpl_cf_parse t_cf_template tpl  ) 
 

This function will parse a template file and print out the parsed content. No memory is allocated, this should be very fast.

Parameters:
tpl The template file structure

Definition at line 136 of file template.c.

void tpl_cf_parse_to_mem t_cf_template tpl  ) 
 

This function parses a template file and store the parsed content into the string structure parsed in the template file structure.

Parameters:
tpl The template file structure

Definition at line 154 of file template.c.

void tpl_cf_setvar t_cf_template tpl,
u_char *  vname,
const u_char *  value,
int  len,
int  escapehtml
 

This function sets a template variable to a specified value.

Parameters:
tpl The template structure
vname The variable name
value The value of the variable
len The length of the value
escapehtml Should the characters in the string converted to HTML entities if neccessary?

Definition at line 82 of file template.c.


Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5