-
Notifications
You must be signed in to change notification settings - Fork 21
/
WzNode.h
95 lines (68 loc) · 1.38 KB
/
WzNode.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// 120114
#ifndef __WzNode_h__
#define __WzNode_h__
#include <map>
#include <vector>
#include <string>
class WzNode;
typedef std::vector<WzNode*> WzNodeList;
//! ¿ÉÒÔʹÓùþÏ£±í
typedef std::map<std::wstring, WzNodeList> WzNodeMap;
class WzNode
{
public:
WzNode();
virtual void AddChild(const std::wstring & name, WzNode * node);
virtual const WzNodeMap & GetChilds() const;
virtual void Delete();
virtual void Free();
virtual bool FreeChild(const std::wstring & name);
virtual void FreeChilds();
virtual WzNode * GetParent();
public:
static WzNode * New();
protected:
virtual ~WzNode();
protected:
WzNode *m_pParent;
WzNodeMap m_Childs;
};
//////////////////////////////////////////////////////////////////////////
class WzDirectory : public WzNode
{
public:
WzDirectory();
void Set(bool img, int size ,int checksum ,unsigned int offset);
unsigned int GetOffset() const;
bool IsImage() const;
public:
static WzDirectory * New();
private:
bool m_bImage;
int m_Size;
int m_Checksum;
unsigned int m_Offset;
};
//////////////////////////////////////////////////////////////////////////
template <typename T>
class WzProperty : public WzNode
{
public:
WzProperty() {}
void Set(T data)
{
m_Data = data;
}
const T & Get() const
{
return m_Data;
}
public:
static WzProperty<T> * New()
{
return new WzProperty<T>();
}
private:
T m_Data;
};
#endif