Inja 3.5.0
A Template Engine for Modern C++
Loading...
Searching...
No Matches
statistics.hpp
1#ifndef INCLUDE_INJA_STATISTICS_HPP_
2#define INCLUDE_INJA_STATISTICS_HPP_
3
4#include "node.hpp"
5
6namespace inja {
7
12 void visit(const BlockNode& node) override {
13 for (const auto& n : node.nodes) {
14 n->accept(*this);
15 }
16 }
17
18 void visit(const TextNode&) override {}
19 void visit(const ExpressionNode&) override {}
20 void visit(const LiteralNode&) override {}
21
22 void visit(const DataNode&) override {
23 variable_counter += 1;
24 }
25
26 void visit(const FunctionNode& node) override {
27 for (const auto& n : node.arguments) {
28 n->accept(*this);
29 }
30 }
31
32 void visit(const ExpressionListNode& node) override {
33 node.root->accept(*this);
34 }
35
36 void visit(const StatementNode&) override {}
37 void visit(const ForStatementNode&) override {}
38
39 void visit(const ForArrayStatementNode& node) override {
40 node.condition.accept(*this);
41 node.body.accept(*this);
42 }
43
44 void visit(const ForObjectStatementNode& node) override {
45 node.condition.accept(*this);
46 node.body.accept(*this);
47 }
48
49 void visit(const IfStatementNode& node) override {
50 node.condition.accept(*this);
51 node.true_statement.accept(*this);
52 node.false_statement.accept(*this);
53 }
54
55 void visit(const IncludeStatementNode&) override {}
56
57 void visit(const ExtendsStatementNode&) override {}
58
59 void visit(const BlockStatementNode& node) override {
60 node.block.accept(*this);
61 }
62
63 void visit(const SetStatementNode&) override {}
64
65public:
66 size_t variable_counter {0};
67
68 explicit StatisticsVisitor() {}
69};
70
71} // namespace inja
72
73#endif // INCLUDE_INJA_STATISTICS_HPP_
Definition node.hpp:70
Definition node.hpp:349
Definition node.hpp:112
Definition node.hpp:255
Definition node.hpp:92
Definition node.hpp:338
Definition node.hpp:285
Definition node.hpp:296
Definition node.hpp:274
Definition node.hpp:135
Definition node.hpp:309
Definition node.hpp:327
Definition node.hpp:101
Definition node.hpp:35
Definition node.hpp:362
Definition node.hpp:267
A class for counting statistics on a Template.
Definition statistics.hpp:11
Definition node.hpp:81