#include <Template.hpp>
Inheritance diagram for Ionflux::Tools::Template:
Public Member Functions | |
Template () | |
Constructor. | |
virtual | ~Template () |
Destructor. | |
virtual void | readTemplate (const std::string &templateFileName, std::vector< TemplateElement * > &target) |
Read template file. | |
virtual void | readTemplate (const std::string &templateFileName) |
Read template file. | |
virtual void | setTemplate (const std::string &newTemplate, std::vector< TemplateElement * > &target) |
Set template. | |
virtual void | setTemplate (const std::string &newTemplate) |
Set template. | |
virtual std::string | process (const std::string &newTemplate="", Node *newConfig=0) |
Process template. | |
virtual void | setMaxNestingDepth (unsigned int newMaxNestingDepth) |
Set maximum nesting depth. | |
virtual unsigned int | getMaxNestingDepth () |
Get maximum nesting depth. | |
virtual void | printElementDebugInfo () |
Print debug information. | |
virtual Reporter & | getLog () |
Get Console output/logging facility. | |
Static Public Attributes | |
static const std::string | ITERATION_COUNTER = "__i" |
Iteration counter node name. | |
static const std::string | NUM_ITERATIONS = "__n" |
Number of iterations node name. | |
static const std::string | CONDITION_NODE = "__cond" |
Condition node name. | |
static const TokenType | TT_TEMPLATE_TAG_OPEN |
Token type: Template tag marker (open). | |
static const TokenType | TT_TEMPLATE_TAG_CLOSE |
Token type: Template tag marker (close). | |
static const TokenType | TT_VAR_MARKER |
Token type: Variable marker. | |
static const TokenType | TT_COMMENT |
Token type: Comment character. | |
static const TokenType | TT_TREEPATH |
Token type: Tree path element. | |
static const TokenType | TT_END_TAG_MARKER |
Token type: End tag marker. | |
static const TokenType | TT_OPERATOR_NSO |
Token type: Operator (excluding slash and OR-sign). | |
static const std::string | TAG_FOREACH = "foreach" |
Tag keyword: foreach. | |
static const std::string | TAG_FOREACH_ELSE = "empty" |
Tag keyword: (foreach) else. | |
static const std::string | TAG_FOREACH_IN = "in" |
Tag keyword: (foreach) in. | |
static const std::string | TAG_IF = "if" |
Tag keyword: if. | |
static const std::string | TAG_IF_ELSE = "else" |
Tag keyword: (if) else. | |
static const std::string | TAG_FIRST = "first" |
Tag keyword: first. | |
static const std::string | TAG_MID = "mid" |
Tag keyword: mid. | |
static const std::string | TAG_LAST = "last" |
Tag keyword: last. | |
static const std::string | TAG_SINGLE = "single" |
Tag keyword: single. | |
static const std::string | TAG_NOTFIRST = "notfirst" |
Tag keyword: notfirst. | |
static const std::string | TAG_NOTMID = "notmid" |
Tag keyword: notmid. | |
static const std::string | TAG_NOTLAST = "notlast" |
Tag keyword: notlast. | |
static const std::string | TAG_NOTSINGLE = "notsingle" |
Tag keyword: notsingle. | |
static const std::string | TAG_INCLUDE = "include" |
Tag keyword: include. | |
static const std::string | TAG_SWRAP = "swrap" |
Tag keyword: swrap. | |
static const std::string | TAG_SECTION = "section" |
Tag keyword: section. | |
static const std::string | TAG_REF = "ref" |
Tag keyword: ref. | |
static const std::string | SWRAP_DEFAULT_LINE_WIDTH = "78" |
SWrap default line width. | |
static const std::string | SWRAP_DEFAULT_LINE_TERM = "\n" |
SWrap default line terminator. | |
static const unsigned int | DEFAULT_MAX_NESTING_DEPTH = 999 |
Default maximum nesting depth. | |
Protected Member Functions | |
virtual void | clearElements () |
Clear element vector. | |
virtual bool | parse (std::vector< TemplateElement * > &target) |
Parse template. | |
virtual bool | parse () |
Parse template input. | |
virtual void | addCharacterData (const std::string &characterData, std::vector< TemplateElement * > &target) |
Add character data. | |
virtual bool | addTemplateTag (const std::string &tagData, std::vector< TemplateElement * > &target) |
Add template tag. | |
virtual bool | preprocess (std::vector< TemplateElement * > &target) |
Preprocess template elements. | |
virtual std::string | process (unsigned int from, unsigned int to, TagNestingLevel depth) |
Process template. | |
Protected Attributes | |
Ionflux::Tools::Reporter | log |
Console output/logging. | |
std::string | templateInput |
Template input. | |
Tokenizer | tok |
Template tokenizer. | |
Tokenizer | tagTok |
Template tag tokenizer. | |
std::vector< TemplateElement * > | elements |
Template elements. | |
TemplateSectionMap | sections |
Template sections. | |
unsigned int | maxNestingDepth |
Maximum nesting depth. |
Create a representation of data dynamically from a template.
|
Constructor. Construct new Template object. |
|
Destructor. Destruct Template object. |
|
Add character data. Creates a new template element for the specified character data. No element will be added if the character data is empty.
|
|
Add template tag. Creates a new template element for the specified template tag data. No element will be added if the tag data is empty.
|
|
Clear element vector.
|
|
Get Console output/logging facility.
Reimplemented from Ionflux::Tools::Tree. |
|
Get maximum nesting depth. Get the maximum nesting depth for template processing.
|
|
Parse template input. Parses the template input into template elements.
|
|
Parse template. Parses the template input into a target vector of template elements.
|
|
Preprocess template elements. Preprocesses template elements.
|
|
Print debug information.
|
|
Process template. Generate a data representation from the template.
|
|
Process template. Generate a data representation from the specified template element range.
|
|
Read template file. Reads a template from a file.
|
|
Read template file. Reads a template from a file.
|
|
Set maximum nesting depth. Set the maximum nesting depth for template processing.
|
|
Set template. Sets the template to the specified byte string.
|
|
Set template. Sets the template to the specified byte string.
|
|
Condition node name. This node name is reserved for storing conditions. |
|
Default maximum nesting depth.
|
|
Template elements.
|
|
Iteration counter node name. This node name is reserved for iteration counting. You can access the iteration counters in a template by accessing the node data entry <ITERATION_COUNTER>[<nesting level>], starting from 0. |
|
Console output/logging.
Reimplemented from Ionflux::Tools::Tree. |
|
Maximum nesting depth.
|
|
Number of iterations node name. This node name is reserved for storing the number of iterations. You can access the number of iterations in a template by accessing the node data entry <NUM_ITERATIONS>[<nesting level>], starting from 0. |
|
Template sections.
|
|
SWrap default line terminator.
|
|
SWrap default line width.
|
|
Tag keyword: first.
|
|
Tag keyword: foreach.
|
|
Tag keyword: (foreach) else.
|
|
Tag keyword: (foreach) in.
|
|
Tag keyword: if.
|
|
Tag keyword: (if) else.
|
|
Tag keyword: include.
|
|
Tag keyword: last.
|
|
Tag keyword: mid.
|
|
Tag keyword: notfirst.
|
|
Tag keyword: notlast.
|
|
Tag keyword: notmid.
|
|
Tag keyword: notsingle.
|
|
Tag keyword: ref.
|
|
Tag keyword: section.
|
|
Tag keyword: single.
|
|
Tag keyword: swrap.
|
|
Template tag tokenizer.
|
|
Template input.
|
|
Template tokenizer.
|
|
Initial value: { TokenType::USERTYPE_ID + 104, "#", false, 1}
|
|
Initial value: { TokenType::USERTYPE_ID + 106, "/", false, 0}
|
|
Initial value: { TokenType::USERTYPE_ID + 107, "+-*=<>&!~%^", false, 0}
|
|
Initial value: { TokenType::USERTYPE_ID + 102, "}", false, 1}
|
|
Initial value: { TokenType::USERTYPE_ID + 101, "{", false, 1}
|
|
Initial value: { TokenType::USERTYPE_ID + 105, ".[]()", false, 0}
|
|
Initial value: { TokenType::USERTYPE_ID + 103, "$@", false, 1}
|