Go to the source code of this file.
◆ tpl_free()
◆ tpl_getfunc()
Get the function frame associated with a template function
- Parameters
-
- Returns
- tplfunc_frame structure
◆ tpl_getval()
| char * tpl_getval |
( |
char * | key | ) |
|
Retrieve the value of a key mapped by the template engine
- Parameters
-
| key | string registered by tpl_register |
- Returns
- a pointer to value, or NULL if the key is not present
◆ tpl_register()
| void tpl_register |
( |
char * | key, |
|
|
char ** | ptr ) |
Map a text value to a pointer in memory
- Parameters
-
| key | in-text variable name |
| ptr | pointer to string |
◆ tpl_register_func()
| void tpl_register_func |
( |
char * | key, |
|
|
tplfunc * | tplfunc_ptr, |
|
|
int | argc, |
|
|
void * | data_in ) |
Register a template function
- Parameters
-
| key | function name to expose to "func:" interface |
| tplfunc_ptr | pointer to function of type tplfunc |
| argc | number of function arguments to accept |
| data_in | pointer to function input data |
◆ tpl_render()
| char * tpl_render |
( |
char * | str | ) |
|
Replaces occurrences of all registered key value pairs in str
- Parameters
-
| str | the text data to render |
- Returns
- a rendered copy of
str, or NULL. The caller is responsible for free()ing memory allocated by this function
◆ tpl_render_to_file()
| int tpl_render_to_file |
( |
char * | str, |
|
|
const char * | filename ) |
Write tpl_render() output to a file
- Parameters
-
| str | the text to render |
| filename | the output file name |
- Returns
- 0 on success, <0 on error