mirror of
https://github.com/pantor/inja.git
synced 2026-05-31 16:24:52 +00:00
improve documentation
This commit is contained in:
@@ -14,6 +14,9 @@ enum class ElementNotation {
|
||||
Pointer
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Class for lexer configuration.
|
||||
*/
|
||||
struct LexerConfig {
|
||||
std::string statement_open {"{%"};
|
||||
std::string statement_close {"%}"};
|
||||
@@ -44,6 +47,9 @@ struct LexerConfig {
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Class for parser configuration.
|
||||
*/
|
||||
struct ParserConfig {
|
||||
ElementNotation notation {ElementNotation::Dot};
|
||||
};
|
||||
|
||||
@@ -22,6 +22,9 @@ namespace inja {
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
/*!
|
||||
* \brief Class for changing the configuration.
|
||||
*/
|
||||
class Environment {
|
||||
class Impl {
|
||||
public:
|
||||
|
||||
@@ -12,6 +12,9 @@ using namespace nlohmann;
|
||||
using Arguments = std::vector<const json*>;
|
||||
using CallbackFunction = std::function<json(Arguments& args)>;
|
||||
|
||||
/*!
|
||||
* \brief Class for builtin functions and user-defined callbacks.
|
||||
*/
|
||||
class FunctionStorage {
|
||||
public:
|
||||
void add_builtin(nonstd::string_view name, unsigned int num_args, Bytecode::Op op) {
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace inja {
|
||||
|
||||
/*!
|
||||
* \brief Class for lexing an inja Template.
|
||||
*/
|
||||
class Lexer {
|
||||
enum class State {
|
||||
Text,
|
||||
|
||||
@@ -58,6 +58,9 @@ class ParserStatic {
|
||||
FunctionStorage functions;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Class for parsing an inja Template.
|
||||
*/
|
||||
class Parser {
|
||||
public:
|
||||
explicit Parser(const ParserConfig& parser_config, const LexerConfig& lexer_config, TemplateStorage& included_templates): m_config(parser_config), m_lexer(lexer_config), m_included_templates(included_templates), m_static(ParserStatic::get_instance()) { }
|
||||
|
||||
@@ -24,6 +24,9 @@ inline nonstd::string_view convert_dot_to_json_pointer(nonstd::string_view dot,
|
||||
return nonstd::string_view(out.data(), out.size());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Class for rendering a Template with data.
|
||||
*/
|
||||
class Renderer {
|
||||
std::vector<const json*>& get_args(const Bytecode& bc) {
|
||||
m_tmp_args.clear();
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
namespace inja {
|
||||
|
||||
/*!
|
||||
* \brief The main inja Template.
|
||||
*/
|
||||
struct Template {
|
||||
std::vector<Bytecode> bytecodes;
|
||||
std::string content;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
namespace inja {
|
||||
|
||||
/*!
|
||||
* \brief Helper-class for the inja Parser.
|
||||
*/
|
||||
struct Token {
|
||||
enum class Kind {
|
||||
Text,
|
||||
|
||||
Reference in New Issue
Block a user