extract template_type from render_context
This commit is contained in:
parent
ba64f4e541
commit
dc513839bd
12 changed files with 153 additions and 129 deletions
|
@ -3,41 +3,41 @@
|
|||
using namespace mstch;
|
||||
|
||||
visitor::render_section::render_section(
|
||||
render_context& ctx, const std::vector<token>& section_tokens, std::set<flag> flags):
|
||||
ctx(ctx), section_tokens(section_tokens), flags(flags)
|
||||
render_context& ctx, const template_type& section,std::set<flag> flags):
|
||||
ctx(ctx), section(section), flags(flags)
|
||||
{
|
||||
}
|
||||
|
||||
std::string visitor::render_section::operator()(
|
||||
const boost::blank& blank) const
|
||||
{
|
||||
return render_context::push(ctx, {{".", {}}}).render(section_tokens);
|
||||
return render_context::push(ctx, {{".", {}}}).render(section);
|
||||
}
|
||||
|
||||
std::string visitor::render_section::operator()(const int& i) const {
|
||||
return render_context::push(ctx, {{".", i}}).render(section_tokens);
|
||||
return render_context::push(ctx, {{".", i}}).render(section);
|
||||
}
|
||||
|
||||
std::string visitor::render_section::operator()(const bool& b) const {
|
||||
return render_context::push(ctx, {{".", b}}).render(section_tokens);
|
||||
return render_context::push(ctx, {{".", b}}).render(section);
|
||||
}
|
||||
|
||||
std::string visitor::render_section::operator()(const std::string& str) const {
|
||||
return render_context::push(ctx, {{".", str}}).render(section_tokens);
|
||||
return render_context::push(ctx, {{".", str}}).render(section);
|
||||
}
|
||||
|
||||
std::string visitor::render_section::operator()(const object& obj) const {
|
||||
return render_context::push(ctx, obj).render(section_tokens);
|
||||
return render_context::push(ctx, obj).render(section);
|
||||
}
|
||||
|
||||
std::string visitor::render_section::operator()(const array& a) const {
|
||||
std::string out;
|
||||
if(flags.find(flag::keep_array) != flags.end())
|
||||
out += render_context::push(ctx, {{".", a}}).render(section_tokens);
|
||||
out += render_context::push(ctx, {{".", a}}).render(section);
|
||||
else
|
||||
for (auto& item: a)
|
||||
out += boost::apply_visitor(
|
||||
render_section(ctx, section_tokens, {flag::keep_array}), item);
|
||||
render_section(ctx, section, {flag::keep_array}), item);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ std::string visitor::render_section::operator()(
|
|||
const renderer_lambda& lambda) const
|
||||
{
|
||||
return "";
|
||||
/*return (lambda())(section_tokens, [&](const std::string& text) {
|
||||
/*return (lambda())(section, [&](const std::string& text) {
|
||||
return render_context::push(ctx).render(text);
|
||||
}); TODO ! */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue