From c6164ae8c8d4826170216ded00a9d0e62aae9bcb Mon Sep 17 00:00:00 2001 From: Daniel Sipka Date: Sat, 11 Apr 2015 16:29:12 +0200 Subject: [PATCH] reformat --- src/mstch.cpp | 3 ++- src/render_context.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mstch.cpp b/src/mstch.cpp index 2252706..7bacca8 100644 --- a/src/mstch.cpp +++ b/src/mstch.cpp @@ -27,7 +27,8 @@ std::string strip_whitespace(std::string tmplt) { } std::string mstch::render( - const std::string& tmplt, const object& root_object, + const std::string& tmplt, + const object& root_object, const std::map& partials) { return render_context(root_object, partials) diff --git a/src/render_context.cpp b/src/render_context.cpp index f151d4d..2350704 100644 --- a/src/render_context.cpp +++ b/src/render_context.cpp @@ -1,9 +1,7 @@ #include "render_context.h" -#include "state/render_state.h" #include "state/outside_section.h" #include -#include using namespace mstch; @@ -32,18 +30,17 @@ const mstch::node& render_context::find_node( const std::string& token, const std::deque& current_objects) { - if (token != "." && token.find('.') != std::string::npos) { + if (token != "." && token.find('.') != std::string::npos) return find_node( token.substr(token.rfind('.') + 1), {boost::get(find_node( token.substr(0, token.rfind('.')), current_objects))}); - } else { + else for (auto& object: current_objects) - if (object.count(token) != 0) + if (object.count(token)) return object.at(token); - return null_node; - } + return null_node; } const mstch::node& render_context::get_node(const std::string& token) {