]> git.sesse.net Git - xml-template/blob - c++0x/xml-template.h
Split out the C++0x library into a separate file from the simple unit test.
[xml-template] / c++0x / xml-template.h
1 #ifndef _XML_TEMPLATE_H
2 #define _XML_TEMPLATE_H 1
3
4 #include <libxml/tree.h>
5
6 #include <string>
7 #include <utility>
8 #include <unordered_map>
9
10 class Directive {
11  public:
12         virtual void process(xmlNode *node, bool clean) = 0;
13 };
14
15 class Replace : public Directive {
16  public:
17         Replace(const std::string &str);
18         virtual void process(xmlNode *node, bool clean);
19
20  private:
21         const std::string str;
22 };
23
24 class Substitute : public Directive {
25  public:
26         Substitute(const std::unordered_map<std::string, Directive*> &substitution_map);
27
28         virtual void process(xmlNode *node, bool clean);
29
30  private:
31         const std::unordered_map<std::string, Directive*> &substitution_map;
32 };
33
34 #endif  // !defined(_XML_TEMPLATE_H)