From 514cb71a6a3e116c229c5dc874369f8632530dc7 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 27 Apr 2021 11:23:17 +0200 Subject: Squashed 'deps/inja/' content from commit 811e173 git-subtree-dir: deps/inja git-subtree-split: 811e1730e13bca4ea1805a42d5f0a4b5c91046e1 --- include/inja/template.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/inja/template.hpp (limited to 'include/inja/template.hpp') diff --git a/include/inja/template.hpp b/include/inja/template.hpp new file mode 100644 index 0000000..9de0a96 --- /dev/null +++ b/include/inja/template.hpp @@ -0,0 +1,39 @@ +// Copyright (c) 2019 Pantor. All rights reserved. + +#ifndef INCLUDE_INJA_TEMPLATE_HPP_ +#define INCLUDE_INJA_TEMPLATE_HPP_ + +#include +#include +#include +#include + +#include "node.hpp" +#include "statistics.hpp" + + +namespace inja { + +/*! + * \brief The main inja Template. + */ +struct Template { + BlockNode root; + std::string content; + + explicit Template() { } + explicit Template(const std::string& content): content(content) { } + + /// Return number of variables (total number, not distinct ones) in the template + int count_variables() { + auto statistic_visitor = StatisticsVisitor(); + root.accept(statistic_visitor); + return statistic_visitor.variable_counter; + } +}; + +using TemplateStorage = std::map; + +} // namespace inja + +#endif // INCLUDE_INJA_TEMPLATE_HPP_ -- cgit v1.2.3