-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPTree.h
executable file
·58 lines (41 loc) · 1.07 KB
/
PTree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef PTREE_H
#define PTREE_H
#include "Convertors.h"
#include <map>
#include <queue>
#include <string>
#include <boost/any.hpp>
template <typename Key>
class PTree {
public:
class Path {
public:
Path();
Path(const std::string& path);
Path(const char* s);
std::string pop();
void push(const std::string& s);
bool empty() const;
private:
std::queue<Key> p_;
};
bool isValidPath(Path path) const;
Convertor get(Path path);
ConstConvertor get(Path path) const;
template <typename T>
T& get(Path path);
template <typename T>
const T& get(Path path) const;
template <typename T>
void put(Path path, const T& value);
template <typename T>
void push(Path path, const T& value);
void del(Path path);
void keysTree(std::ostream& o, int indent = 0) const;
private:
typedef std::map<Key, boost::any> TreeType;
TreeType data_;
};
// include implementation
#include "PTree.cpp"
#endif // PTREE_H