aboutsummaryrefslogtreecommitdiff
path: root/src/tafnode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tafnode.h')
-rw-r--r--src/tafnode.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/tafnode.h b/src/tafnode.h
new file mode 100644
index 0000000..cb4093f
--- /dev/null
+++ b/src/tafnode.h
@@ -0,0 +1,94 @@
1#ifndef BU_TAF_NODE_H
2#define BU_TAF_NODE_H
3
4#include <stdint.h>
5#include "bu/fstring.h"
6#include "bu/hash.h"
7#include "bu/list.h"
8
9namespace Bu
10{
11 /**
12 *
13 */
14 class TafNode
15 {
16 public:
17 enum NodeType
18 {
19 typeGroup,
20 typeProperty,
21 typeComment
22 };
23
24 public:
25 TafNode( NodeType eType );
26 virtual ~TafNode();
27
28 const NodeType getType() const;
29
30 private:
31 NodeType eType;
32 };
33
34 class TafProperty;
35 class TafComment;
36 class TafGroup : public TafNode
37 {
38 public:
39 typedef Bu::List<Bu::FString> PropList;
40 typedef Bu::Hash<Bu::FString, PropList> PropHash;
41 typedef Bu::List<class Bu::TafGroup *> GroupList;
42 typedef Bu::Hash<Bu::FString, GroupList> GroupHash;
43 typedef Bu::List<class Bu::TafNode *> NodeList;
44
45 TafGroup( const Bu::FString &sName );
46 virtual ~TafGroup();
47
48 const Bu::FString &getName() const;
49
50 const Bu::FString &getProperty( const Bu::FString &sName ) const;
51 const PropList &getProperties( const Bu::FString &sName ) const;
52 const TafGroup *getChild( const Bu::FString &sName ) const;
53 const GroupList &getChildren( const Bu::FString &sName ) const;
54 TafNode *addChild( TafNode *pNode );
55 TafGroup *addChild( TafGroup *pNode );
56 TafProperty *addChild( TafProperty *pNode );
57 TafComment *addChild( TafComment *pNode );
58 const NodeList &getChildren() const;
59
60 private:
61 Bu::FString sName;
62 PropHash hProp;
63 GroupHash hChildren;
64 NodeList lChildren;
65 };
66
67 class TafProperty : public TafNode
68 {
69 public:
70 TafProperty( const Bu::FString &sName, const Bu::FString &sValue );
71 virtual ~TafProperty();
72
73 const Bu::FString &getName() const;
74 const Bu::FString &getValue() const;
75
76 private:
77 Bu::FString sName;
78 Bu::FString sValue;
79 };
80
81 class TafComment : public TafNode
82 {
83 public:
84 TafComment( const Bu::FString &sText );
85 virtual ~TafComment();
86
87 const Bu::FString &getText() const;
88
89 private:
90 Bu::FString sText;
91 };
92}
93
94#endif