diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/tafnode.h | |
parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to 'src/tafnode.h')
-rw-r--r-- | src/tafnode.h | 94 |
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 | |||
9 | namespace 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 | ||