Rudiments
|
#include <templateengine.h>
Inherits object.
The templateengine class provides a framework for registering user-defined methods to parse and perform replacements in marked-up files or strings.
templateengine::templateengine | ( | ) |
Creates an instance of the templateengine class.
|
virtual |
Deletes this instance of the templateengine class.
Returns the delimiter that the parse() methods look for at the end of a block-end.
The default is " -->".
For example, by defaults, blocks are delimited like:
... block ...
Returns the delimiter that the parse() methods look for at the beginning of a block-end.
The default is "<!-- end ".
For example, by defaults, blocks are delimited like:
... block ...
Returns the delimiter that the parse() methods look for at the end of a block-start.
The default is " -->".
For example, by defaults, blocks are delimited like:
... block ...
Returns the delimiter that the parse() methods look for at beginning of a block-start.
The default is "<!-- start ".
For example, by defaults, blocks are delimited like:
... block ...
Returns the delimiter that the parse() methods look for at the end of a variable whos value's double-quotes shall be escaped.
The default is ")".
For example, by defaults, variables are delimited like:
Returns the delimiter that the parse() methods look for at the beginning of a variable whos value's double-quotes shall be escaped.
The default is "$dq(".
For example, by defaults, variables are delimited like:
Returns the error that occurred if a parse() method returned false.
char templateengine::getEscapeCharacter | ( | ) |
Returns the escape character. Defaults to backslash.
Returns the delimiter that the parse() methods look for at the end of an include.
The default is " -->".
For example, by defaults, blocks are delimited like:
Returns the delimiter that the parse() methods look for at the beginning of an include.
The default is "<!-- include ".
For example, by defaults, blocks are delimited like:
Returns the delimiter that the parse() methods look for at the end of a variable whos value's single-quotes shall be escaped.
The default is ")".
For example, by defaults, variables are delimited like:
Returns the delimiter that the parse() methods look for at the beginning of a variable whos value's single-quotes shall be escaped.
The default is "$q(".
For example, by defaults, variables are delimited like:
Returns the delimiter that the parse() methods look for at the end of a variable.
The default is ")".
For example, by defaults, variables are delimited like:
Returns the delimiter that the parse() methods look for at the beginning of a variable.
The default is "$(".
For example, by defaults, variables are delimited like:
bool templateengine::parse | ( | output * | out, |
const char * | block, | ||
uint64_t | blocklength, | ||
blockparser * | blockparsers, | ||
dictionary< const char *, const char * > * | vars ) |
Parses "length" characters of "block" and writes the out to "out". For each variable encountered, values from "vars" are substituted. For each nested block encountered, the block is looked up in "blockparsers" and the appropriate block parser method is called. The block parser method is passed "req", "resp", the name, data and character length of the block, "out" and "data" from the blockparser entry.
If a block is encountered but no block parser method is registered for it, it is parsed using "vars".
Returns false if a block parser method returns false and true otherwise.
bool templateengine::parse | ( | output * | out, |
const char * | filename, | ||
blockparser * | blockparsers, | ||
dictionary< const char *, const char * > * | vars ) |
Parses the file at "filename" and writes the out to "out". For each variable encountered, values from "vars" are substituted. For each block encountered, the block is looked up in "blockparsers" and the appropriate block parser method is called. The block parser method is passed "req", "resp", "out", the name, data and character length of the block and "data" from the blockparser entry.
If a block is encountered but no block parser method is registered for it, it is parsed using "vars".
Returns false if a block parser method returns false and true otherwise.
bool templateengine::parse | ( | output * | out, |
const char * | filename, | ||
fileparser * | fileparsers, | ||
dictionary< const char *, const char * > * | vars ) |
Looks up "filename" in "fileparsers", and calls the appropriate file parser method.
For each variable encountered in "filename", values from "vars" are substitued.
Returns true on success and false if the file parser method returns false or if no fileparser was found.
Sets the delimiter that the parse() methods look for at the end of a block-end to "delimiter".
Defaults to " -->".
For example, by defaults, blocks are delimited like:
... block ...
Sets the delimiter that the parse() methods look for at the beginning of a block-end to "delimiter".
Defaults to "<!-- end ".
For example, by defaults, blocks are delimited like:
... block ...
Sets the delimiter that the parse() methods look for at the end of a block-start to "delimiter".
Defaults to " -->".
For example, by defaults, blocks are delimited like:
... block ...
Sets the delimiter that the parse() methods look for at beginning of a block-start to "delimiter".
Defaults to "<!-- start ".
For example, by defaults, blocks are delimited like:
... block ...
Sets the delimiter that the parse() methods look for at the end of a variable whos value's double-quotes shall be escaped to "delimiter".
Defaults to ")".
For example, by defaults, variables are delimited like:
Sets the delimiter that the parse() methods look for at the beginning of a variable whos value's double-quotes shall be escaped to "delimiter".
Defaults to "$dq(".
For example, by defaults, variables are delimited like:
Sets the escape character. Defaults to backslash.
Sets the delimiter that the parse() methods look for at the end of an include to "delimiter".
Defaults to " -->".
For example, by defaults, blocks are delimited like:
Sets the delimiter that the parse() methods look for at the beginning of an include to "delimiter".
Defaults to "<!-- include ".
For example, by defaults, blocks are delimited like:
Sets the delimiter that the parse() methods look for at the end of a variable whos value's single-quotes shall be escaped to "delimiter".
Defaults to ")".
For example, by defaults, variables are delimited like:
Sets the delimiter that the parse() methods look for at the beginning of a variable whos value's single-quotes shall be escaped to "delimiter".
Defaults to "$q(".
For example, by defaults, variables are delimited like:
Sets the delimiter that the parse() methods look for at the end of a variable to "delimiter".
Defaults to ")".
For example, by defaults, variables are delimited like: