Class DrTemplateBase

Synopsis

#include <lib/inc/drogon/DrTemplateBase.h>

class 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
genTextGenerate the text string.
newTemplateCreate an object of the implementation class.

Source

Lines 32-55 in lib/inc/drogon/DrTemplateBase.h. Line 33 in lib/inc/drogon/DrTemplateBase.h.

class 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(
        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(){};
};





Add Discussion as Guest

Log in to DocsForge