Class DrTemplateBase
Synopsis
#include <lib/inc/drogon/DrTemplateBase.h>
class DROGON_EXPORT DrTemplateBase : public virtual DrObjectBase
Description
The templating engine class.
This class can generate a text string from the template file and template data. For more details on the template file, see the wiki site (the 'View' section)
Inheritance
Ancestors: DrObjectBase
Decsendents: DrTemplate
Methods
DrTemplateBase | ||
~DrTemplateBase | ||
genText | Generate the text string. | |
newTemplate | Create an object of the implementation class. |
Source
Lines 33-56 in lib/inc/drogon/DrTemplateBase.h.
class DROGON_EXPORT DrTemplateBase : public virtual DrObjectBase
{
public:
/// Create an object of the implementation class
/**
* @param templateName represents the name of the template file. A template
* file is a description file with a special format. Its extension is
* usually .csp. The user should preprocess the template file with the
* drogon_ctl tool to create c++ source files.
*/
static std::shared_ptr<DrTemplateBase> newTemplate(
const std::string &templateName);
/// Generate the text string
/**
* @param data represents data rendered in the string in a format
* according to the template file.
*/
virtual std::string genText(
const DrTemplateData &data = DrTemplateData()) = 0;
virtual ~DrTemplateBase(){};
DrTemplateBase(){};
};