Class for rendering a Template with data. More...
#include <inja.hpp>
Public Member Functions | |
| Renderer (const RenderConfig &config, const TemplateStorage &template_storage, const FunctionStorage &function_storage) | |
| void | render_to (std::ostream &os, const Template &tmpl, const json &data, json *loop_data=nullptr) |
| Public Member Functions inherited from inja::NodeVisitor | |
| virtual | ~NodeVisitor ()=default |
Private Types | |
| using | Op = FunctionStorage::Operation |
Private Member Functions | |
| void | print_data (const std::shared_ptr< json > &value) |
| const std::shared_ptr< json > | eval_expression_list (const ExpressionListNode &expression_list) |
| void | throw_renderer_error (const std::string &message, const AstNode &node) |
| void | make_result (const json &&result) |
| template<size_t N, size_t N_start = 0, bool throw_not_found = true> | |
| std::array< const json *, N > | get_arguments (const FunctionNode &node) |
| template<bool throw_not_found = true> | |
| Arguments | get_argument_vector (const FunctionNode &node) |
| void | visit (const BlockNode &node) override |
| void | visit (const TextNode &node) override |
| void | visit (const ExpressionNode &) override |
| void | visit (const LiteralNode &node) override |
| void | visit (const DataNode &node) override |
| void | visit (const FunctionNode &node) override |
| void | visit (const ExpressionListNode &node) override |
| void | visit (const StatementNode &) override |
| void | visit (const ForStatementNode &) override |
| void | visit (const ForArrayStatementNode &node) override |
| void | visit (const ForObjectStatementNode &node) override |
| void | visit (const IfStatementNode &node) override |
| void | visit (const IncludeStatementNode &node) override |
| void | visit (const ExtendsStatementNode &node) override |
| void | visit (const BlockStatementNode &node) override |
| void | visit (const SetStatementNode &node) override |
Static Private Member Functions | |
| static bool | truthy (const json *data) |
Private Attributes | |
| const RenderConfig | config |
| const TemplateStorage & | template_storage |
| const FunctionStorage & | function_storage |
| const Template * | current_template |
| size_t | current_level {0} |
| std::vector< const Template * > | template_stack |
| std::vector< const BlockStatementNode * > | block_statement_stack |
| const json * | data_input |
| std::ostream * | output_stream |
| json | additional_data |
| json * | current_loop_data = &additional_data["loop"] |
| std::vector< std::shared_ptr< json > > | data_tmp_stack |
| std::stack< const json * > | data_eval_stack |
| std::stack< const DataNode * > | not_found_stack |
| bool | break_rendering {false} |
|
private |
|
inlineexplicit |
Definition at line 2958 of file inja.hpp.
References config, function_storage, and template_storage.
Referenced by inja::Environment::render_to(), and visit().
|
inlineprivate |
Definition at line 2381 of file inja.hpp.
References inja::ExpressionNode::accept(), data_eval_stack, inja::DataNode::name, not_found_stack, inja::ExpressionListNode::root, and throw_renderer_error().
Referenced by visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 2457 of file inja.hpp.
References inja::ExpressionNode::accept(), inja::FunctionNode::arguments, data_eval_stack, inja::DataNode::name, not_found_stack, and throw_renderer_error().
Referenced by visit().
|
inlineprivate |
Definition at line 2422 of file inja.hpp.
References inja::ExpressionNode::accept(), inja::FunctionNode::arguments, data_eval_stack, inja::DataNode::name, not_found_stack, and throw_renderer_error().
Referenced by visit().
|
inlineprivate |
Definition at line 2415 of file inja.hpp.
References data_eval_stack, and data_tmp_stack.
Referenced by visit().
|
inlineprivate |
Definition at line 2364 of file inja.hpp.
References config, inja::RenderConfig::html_autoescape, inja::htmlescape(), and output_stream.
Referenced by visit().
|
inline |
Definition at line 2964 of file inja.hpp.
References inja::BlockNode::accept(), additional_data, current_loop_data, current_template, data_input, data_tmp_stack, output_stream, inja::Template::root, and template_stack.
Referenced by inja::Environment::render_to(), visit(), and visit().
|
inlineprivate |
Definition at line 2410 of file inja.hpp.
References inja::Template::content, current_template, inja::get_source_location(), inja::AstNode::pos, and inja::RenderError::RenderError().
Referenced by eval_expression_list(), get_argument_vector(), get_arguments(), visit(), visit(), visit(), visit(), and visit().
|
inlinestaticprivate |
Definition at line 2353 of file inja.hpp.
Referenced by visit(), and visit().
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2486 of file inja.hpp.
References inja::AstNode::accept(), break_rendering, and inja::BlockNode::nodes.
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2936 of file inja.hpp.
References inja::BlockNode::accept(), inja::BlockStatementNode::block, block_statement_stack, inja::Template::block_storage, current_level, current_template, inja::BlockStatementNode::name, and template_stack.
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2507 of file inja.hpp.
References additional_data, inja::FunctionStorage::Callback, inja::FunctionStorage::FunctionData::callback, data_eval_stack, data_input, data_tmp_stack, inja::FunctionStorage::find_function(), function_storage, inja::DataNode::name, not_found_stack, inja::FunctionStorage::FunctionData::operation, and inja::DataNode::ptr.
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2818 of file inja.hpp.
References eval_expression_list(), and print_data().
|
inlineoverrideprivatevirtual |
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2925 of file inja.hpp.
References additional_data, break_rendering, config, data_input, inja::ExtendsStatementNode::file, output_stream, render_to(), template_storage, inja::RenderConfig::throw_at_missing_includes, and throw_renderer_error().
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2828 of file inja.hpp.
References inja::BlockNode::accept(), additional_data, inja::ForStatementNode::body, inja::ForStatementNode::condition, current_loop_data, eval_expression_list(), throw_renderer_error(), and inja::ForArrayStatementNode::value.
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2867 of file inja.hpp.
References inja::BlockNode::accept(), additional_data, inja::ForStatementNode::body, inja::ForStatementNode::condition, current_loop_data, eval_expression_list(), inja::ForObjectStatementNode::key, throw_renderer_error(), and inja::ForObjectStatementNode::value.
|
inlineoverrideprivatevirtual |
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2527 of file inja.hpp.
References inja::BlockNode::accept(), inja::ExpressionNode::accept(), inja::FunctionStorage::Add, inja::FunctionStorage::And, inja::FunctionNode::arguments, inja::FunctionStorage::At, inja::FunctionStorage::AtId, inja::BlockStatementNode::block, block_statement_stack, inja::Template::block_storage, inja::FunctionStorage::Callback, inja::FunctionNode::callback, inja::FunctionStorage::Capitalize, inja::DataNode::convert_dot_to_ptr(), current_level, current_template, data_eval_stack, data_input, data_tmp_stack, inja::FunctionStorage::Default, inja::FunctionStorage::DivisibleBy, inja::FunctionStorage::Division, inja::FunctionStorage::Equal, inja::FunctionStorage::Even, inja::FunctionStorage::Exists, inja::FunctionStorage::ExistsInObject, inja::FunctionStorage::First, inja::FunctionStorage::Float, get_argument_vector(), get_arguments(), inja::FunctionStorage::Greater, inja::FunctionStorage::GreaterEqual, inja::FunctionStorage::In, inja::FunctionStorage::Int, inja::FunctionStorage::IsArray, inja::FunctionStorage::IsBoolean, inja::FunctionStorage::IsFloat, inja::FunctionStorage::IsInteger, inja::FunctionStorage::IsNumber, inja::FunctionStorage::IsObject, inja::FunctionStorage::IsString, inja::FunctionStorage::Join, inja::FunctionStorage::Last, inja::FunctionStorage::Length, inja::FunctionStorage::Less, inja::FunctionStorage::LessEqual, inja::FunctionStorage::Lower, make_result(), inja::FunctionStorage::Max, inja::FunctionStorage::Min, inja::FunctionStorage::Modulo, inja::FunctionStorage::Multiplication, inja::BlockStatementNode::name, inja::DataNode::name, inja::FunctionStorage::None, inja::FunctionStorage::Not, not_found_stack, inja::FunctionStorage::NotEqual, inja::FunctionStorage::Odd, inja::FunctionNode::operation, inja::FunctionStorage::Or, inja::FunctionStorage::Power, inja::FunctionStorage::Range, inja::FunctionStorage::Replace, inja::replace_substring(), inja::FunctionStorage::Round, inja::FunctionStorage::Sort, inja::FunctionStorage::Subtract, inja::FunctionStorage::Super, template_stack, throw_renderer_error(), truthy(), and inja::FunctionStorage::Upper.
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2906 of file inja.hpp.
References inja::BlockNode::accept(), inja::IfStatementNode::condition, eval_expression_list(), inja::IfStatementNode::false_statement, inja::IfStatementNode::has_false_statement, inja::IfStatementNode::true_statement, and truthy().
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2915 of file inja.hpp.
References additional_data, config, data_input, inja::IncludeStatementNode::file, function_storage, output_stream, render_to(), Renderer(), template_storage, inja::RenderConfig::throw_at_missing_includes, and throw_renderer_error().
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2503 of file inja.hpp.
References data_eval_stack, and inja::LiteralNode::value.
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2950 of file inja.hpp.
References additional_data, eval_expression_list(), inja::SetStatementNode::expression, inja::SetStatementNode::key, and inja::replace_substring().
|
inlineoverrideprivatevirtual |
|
inlineoverrideprivatevirtual |
Implements inja::NodeVisitor.
Definition at line 2496 of file inja.hpp.
References inja::Template::content, current_template, inja::TextNode::length, output_stream, and inja::AstNode::pos.
|
private |
|
private |
|
private |
|
private |
Definition at line 2332 of file inja.hpp.
Referenced by print_data(), Renderer(), visit(), and visit().
|
private |
|
private |
Definition at line 2345 of file inja.hpp.
Referenced by render_to(), visit(), and visit().
|
private |
Definition at line 2336 of file inja.hpp.
Referenced by render_to(), throw_renderer_error(), visit(), visit(), and visit().
|
private |
Definition at line 2348 of file inja.hpp.
Referenced by eval_expression_list(), get_argument_vector(), get_arguments(), make_result(), visit(), visit(), and visit().
|
private |
|
private |
Definition at line 2347 of file inja.hpp.
Referenced by make_result(), render_to(), visit(), and visit().
|
private |
Definition at line 2334 of file inja.hpp.
Referenced by Renderer(), visit(), and visit().
|
private |
Definition at line 2349 of file inja.hpp.
Referenced by eval_expression_list(), get_argument_vector(), get_arguments(), visit(), and visit().
|
private |
Definition at line 2342 of file inja.hpp.
Referenced by print_data(), render_to(), visit(), visit(), and visit().
|
private |
Definition at line 2338 of file inja.hpp.
Referenced by render_to(), visit(), and visit().
|
private |
Definition at line 2333 of file inja.hpp.
Referenced by Renderer(), visit(), and visit().