xmltooling  1.4.2
xmltooling::TemplateEngine Class Reference

Simple template replacement engine. More...

#include <xmltooling/util/TemplateEngine.h>

Collaboration diagram for xmltooling::TemplateEngine:

Classes

class  TemplateParameters
 Interface to parameters to plug into templates. More...
 

Public Member Functions

 TemplateEngine ()
 Default constructor. More...
 
void setTagPrefix (const char *tagPrefix)
 Sets the tag name to use when locating template replacement tags. More...
 
virtual void run (std::istream &is, std::ostream &os, const TemplateParameters &parameters, const XMLToolingException *e=0) const
 Processes template from an input stream and executes replacements and conditional logic based on parameters. More...
 

Static Public Attributes

static std::string unsafe_chars
 List of non-built-in characters considered "unsafe" and requiring HTML encoding. More...
 

Detailed Description

Simple template replacement engine.

Supports the following:

  • <mlp key/>
  • <mlpif key> stuff </mlpif>
  • <mlpifnot key> stuff </mlpifnot>
  • <mlpfor key> stuff </mlpfor>
  • <mlp $name/> (in for loop only)
  • <mlp $value/> (in for loop only)

The default tag prefix is "mlp". This can be overridden for compatibility.

Constructor & Destructor Documentation

xmltooling::TemplateEngine::TemplateEngine ( )

Default constructor.

Member Function Documentation

virtual void xmltooling::TemplateEngine::run ( std::istream &  is,
std::ostream &  os,
const TemplateParameters parameters,
const XMLToolingException e = 0 
) const
virtual

Processes template from an input stream and executes replacements and conditional logic based on parameters.

Parameters
isinput stream providing template
osoutput stream to send results of executing template
parametersparameters to plug into template
eoptional exception to extract parameters from
void xmltooling::TemplateEngine::setTagPrefix ( const char *  tagPrefix)

Sets the tag name to use when locating template replacement tags.

Parameters
tagPrefixbase prefix for tags

Member Data Documentation

std::string xmltooling::TemplateEngine::unsafe_chars
static

List of non-built-in characters considered "unsafe" and requiring HTML encoding.

The default set is #%&():[]\`{}


The documentation for this class was generated from the following file: