A manager class used to abstract interactions with the templating engine.
More...
#include <TemplateManager.h>
|
void | init (spt::servlet::model::ServerConfigurationPtr configuration) |
| Initialise the template engine with configuration from the server configuration file (minnal.xml ). More...
|
|
void | setInterval (long interval) |
|
void | addDirectory (const std::string &path) |
| Add the specified directory to the template engine search path. More...
|
|
std::string | expand (const std::string &templateName, ctemplate::TemplateDictionary *data) |
| Convenience method used to return the expanded representation of the specified template using the specified data dictionary. More...
|
|
void | reload (Poco::Timer &timer) |
| Callback method invoked by the timer after the timer interval has expired. More...
|
|
std::string | getFilePath (const std::string &templateName) |
| Return the filesytem path for the template by searching within the template directory search path(s). More...
|
|
A manager class used to abstract interactions with the templating engine.
Minnal uses Google ctemplate as the templating engine. This class exists primarily to run a timer that signlas the template engine to reload any templates modified on disk.
- Date
- Created 2014/09/29 21:50:41
- Copyright
- Copyright © 2014, Sans Pareil Technologies, Inc.
- Author
- Rakesh
- Version
- Id
- TemplateManager.h 5632 2014-10-06 22:04:21Z rakesh
- Since
- 1.6.3
void spt::servlet::templating::TemplateManager::addDirectory |
( |
const std::string & |
path | ) |
|
Add the specified directory to the template engine search path.
The first time this method is invoked, sets the specified directory as the template engine root directory. Additional invocations will add the specified directory as alternate root directories in which templates are stored.
- Parameters
-
path | The path from which templates are to be loaded. |
std::string spt::servlet::templating::TemplateManager::expand |
( |
const std::string & |
templateName, |
|
|
ctemplate::TemplateDictionary * |
data |
|
) |
| |
Convenience method used to return the expanded representation of the specified template using the specified data dictionary.
- Parameters
-
templateName | The name of the template that is to be loaded and expanded by the template engine. |
data | The data dictionary to use to expand the template. |
- Returns
- The string that represents the expanded template.
ctemplate::TemplateCache* spt::servlet::templating::TemplateManager::getCache |
( |
| ) |
|
|
protected |
std::string spt::servlet::templating::TemplateManager::getFilePath |
( |
const std::string & |
templateName | ) |
|
Return the filesytem path for the template by searching within the template directory search path(s).
- Parameters
-
templateName | The name of the template as specified to the template engine. |
- Returns
- The path to the location of the template
static TemplateManager& spt::servlet::templating::TemplateManager::getTemplateManager |
( |
| ) |
|
|
static |
- Returns
- Returns the singleton instance of the template manager.
Initialise the template engine with configuration from the server configuration file (minnal.xml
).
- Parameters
-
configuration | The server configuration information. |
void spt::servlet::templating::TemplateManager::reload |
( |
Poco::Timer & |
timer | ) |
|
Callback method invoked by the timer after the timer interval has expired.
- Parameters
-
timer | The timer instance that invoked the callback |
void spt::servlet::templating::TemplateManager::setInterval |
( |
long |
interval | ) |
|
|
inline |
- Parameters
-
interval | The periodic interval at which the timer is to fire |
The documentation for this class was generated from the following file: