#pragma once #ifndef PARSODUS_TEMPLATE_H #define PARSODUS_TEMPLATE_H #include #include #include #include namespace pds { namespace templ { /** * A changeable information structure for templates */ using TemplateContext = mstch::node; /** * Make a TemplateContext string */ TemplateContext make_string(std::string); /** * Make a TemplateContext map/dictionary */ TemplateContext make_map(std::map); /** * Make a TemplateContext array/vector */ TemplateContext make_array(std::vector); /** * A generic wrapper around whichever templating system gets used */ class Template { public: /** * Construct a Template from given filename * * @param filename The name of the file which contains the template rules */ Template(std::string filename); /** * Destructor */ ~Template(); /** * Render this template to `out` using the information in `context` * * @param out The ostream to render to * @param context The information to provide the template rules while rendering */ void render(std::ostream& out, TemplateContext& context); private: std::string m_filename; }; } //namespace templ } //namespace pds #endif //PARSODUS_TEMPLATE_H