aboutsummaryrefslogtreecommitdiff
path: root/include/inja/template.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/inja/template.hpp')
-rw-r--r--include/inja/template.hpp39
1 files changed, 39 insertions, 0 deletions
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 <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#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<std::string, Template>;
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_TEMPLATE_HPP_