blob: 3156c8b7e799faba85cb4ee28055e77a29672bf1 (
plain)
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
|
/*
* ProtocolTreeNode.h
*
* Created on: 26/06/2012
* Author: Antonio
*/
#if !defined(PROTOCOLNODE_H)
#define PROTOCOLNODE_H
#include <string>
#include <vector>
#include <map>
using namespace std;
class ProtocolTreeNode {
public:
vector<unsigned char>* data;
string tag;
map<string, string> *attributes;
vector<ProtocolTreeNode*> *children;
ProtocolTreeNode(const string& tag, map<string, string> *attributes, ProtocolTreeNode* child);
ProtocolTreeNode(const string& tag, map<string, string> *attributes, vector<unsigned char>* data = NULL, vector<ProtocolTreeNode*> *children = NULL);
string toString();
ProtocolTreeNode* getChild(const string& id);
ProtocolTreeNode* getChild(size_t id);
string* getAttributeValue(const string& attribute);
vector<ProtocolTreeNode*>* getAllChildren();
vector<ProtocolTreeNode*>* getAllChildren(const string& tag);
std::string* getDataAsString();
static bool tagEquals(ProtocolTreeNode *node, const string& tag);
static void require(ProtocolTreeNode *node, const string& tag);
virtual ~ProtocolTreeNode();
};
#endif /* PROTOCOLNODE_H_ */
|