This commit is contained in:
Daniel Sipka 2015-04-09 20:41:27 +02:00
parent 9637d0ec7b
commit eb98985815
207 changed files with 11155 additions and 0 deletions

View file

@ -0,0 +1,38 @@
#include "render_section.h"
#include "is_node_empty.h"
using namespace mstch;
visitor::render_section::render_section(render_context& context, const std::string& section):
context(context),
section(section)
{
}
std::string visitor::render_section::operator()(const boost::blank& blank) const {
return "";
}
std::string visitor::render_section::operator()(const int& i) const {
return render_context(mstch::object{{".", i}}, context).render(section);
}
std::string visitor::render_section::operator()(const bool& b) const {
return render_context(mstch::object{{".", b}}, context).render(section);
}
std::string visitor::render_section::operator()(const std::string& str) const {
return render_context(mstch::object{{".", str}}, context).render(section);
}
std::string visitor::render_section::operator()(const array& arr) const {
std::ostringstream out;
for (auto& item: arr)
if (!boost::apply_visitor(visitor::is_node_empty(), item))
out << boost::apply_visitor(*this, item);
return out.str();
}
std::string visitor::render_section::operator()(const object& obj) const {
return render_context(obj, context).render(section);
}