Inja 3.3.0
A Template Engine for Modern C++
Loading...
Searching...
No Matches
template.hpp
1#ifndef INCLUDE_INJA_TEMPLATE_HPP_
2#define INCLUDE_INJA_TEMPLATE_HPP_
3
4#include <map>
5#include <memory>
6#include <string>
7#include <vector>
8
9#include "node.hpp"
10#include "statistics.hpp"
11
12
13namespace inja {
14
18struct Template {
19 BlockNode root;
20 std::string content;
21 std::map<std::string, std::shared_ptr<BlockStatementNode>> block_storage;
22
23 explicit Template() { }
24 explicit Template(const std::string& content): content(content) { }
25
28 auto statistic_visitor = StatisticsVisitor();
29 root.accept(statistic_visitor);
30 return statistic_visitor.variable_counter;
31 }
32};
33
34using TemplateStorage = std::map<std::string, Template>;
35
36} // namespace inja
37
38#endif // INCLUDE_INJA_TEMPLATE_HPP_
Definition: node.hpp:70
A class for counting statistics on a Template.
Definition: statistics.hpp:12
The main inja Template.
Definition: template.hpp:18
int count_variables()
Return number of variables (total number, not distinct ones) in the template.
Definition: template.hpp:27