drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
drogon::DrTemplateBase Class Referenceabstract

The templating engine class. More...

#include <drogon/DrTemplateBase.h>

Inheritance diagram for drogon::DrTemplateBase:
Collaboration diagram for drogon::DrTemplateBase:

Public Member Functions

virtual std::string genText (const DrTemplateData &data=DrTemplateData())=0
 Generate the text string.
Public Member Functions inherited from drogon::DrObjectBase
virtual const std::string & className () const
 Get the class name.
virtual bool isClass (const std::string &class_name) const
 Return true if the class name is 'class_name'.

Static Public Member Functions

static std::shared_ptr< DrTemplateBase > newTemplate (const std::string &templateName)
 Create an object of the implementation class.

Detailed 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)

Member Function Documentation

◆ genText()

virtual std::string drogon::DrTemplateBase::genText ( const DrTemplateData & data = DrTemplateData())
pure virtual

Generate the text string.

Parameters
datarepresents data rendered in the string in a format according to the template file.

Implemented in drogon::NotFound.

◆ newTemplate()

std::shared_ptr< DrTemplateBase > drogon::DrTemplateBase::newTemplate ( const std::string & templateName)
static

Create an object of the implementation class.

Parameters
templateNamerepresents 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.

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