aboutsummaryrefslogtreecommitdiff
path: root/src/tafnode.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-06-27 18:11:13 +0000
committerMike Buland <eichlan@xagasoft.com>2007-06-27 18:11:13 +0000
commitc86c0cf088492e02431dffb1f860ff2f6faa492d (patch)
tree1191879314028bb8f58daf45d48dacc6ba9ea583 /src/tafnode.h
parent5ec9a131e12d021c42b46b601f5e79502485bebb (diff)
downloadlibbu++-c86c0cf088492e02431dffb1f860ff2f6faa492d.tar.gz
libbu++-c86c0cf088492e02431dffb1f860ff2f6faa492d.tar.bz2
libbu++-c86c0cf088492e02431dffb1f860ff2f6faa492d.tar.xz
libbu++-c86c0cf088492e02431dffb1f860ff2f6faa492d.zip
The taf system is new and improved. The writer works, we added C++ style
comment blocks, and it retains the order of all nodes.
Diffstat (limited to '')
-rw-r--r--src/tafnode.h68
1 files changed, 58 insertions, 10 deletions
diff --git a/src/tafnode.h b/src/tafnode.h
index 08f78e8..55a5123 100644
--- a/src/tafnode.h
+++ b/src/tafnode.h
@@ -14,29 +14,77 @@ namespace Bu
14 class TafNode 14 class TafNode
15 { 15 {
16 public: 16 public:
17 typedef Bu::List<Bu::FString> PropList; 17 enum NodeType
18 typedef Bu::Hash<Bu::FString, PropList> PropHash; 18 {
19 typedef Bu::List<TafNode *> NodeList; 19 typeGroup,
20 typedef Bu::Hash<Bu::FString, NodeList> NodeHash; 20 typeProperty,
21 typeComment
22 };
21 23
22 public: 24 public:
23 TafNode(); 25 TafNode( NodeType eType );
24 virtual ~TafNode(); 26 virtual ~TafNode();
25 27
26 void setName( const Bu::FString &sName ); 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
27 const Bu::FString &getName() const; 48 const Bu::FString &getName() const;
28 49
29 void setProperty( Bu::FString sName, Bu::FString sValue );
30 const Bu::FString &getProperty( const Bu::FString &sName ) const; 50 const Bu::FString &getProperty( const Bu::FString &sName ) const;
31 const PropList &getProperties( const Bu::FString &sName ) const; 51 const PropList &getProperties( const Bu::FString &sName ) const;
32 const TafNode *getChild( const Bu::FString &sName ) const; 52 const TafGroup *getChild( const Bu::FString &sName ) const;
33 const NodeList &getChildren( const Bu::FString &sName ) const; 53 const GroupList &getChildren( const Bu::FString &sName ) const;
34 void addChild( TafNode *pNode ); 54 void addChild( TafNode *pNode );
55 const NodeList &getChildren() const;
35 56
36 private: 57 private:
37 Bu::FString sName; 58 Bu::FString sName;
38 PropHash hProp; 59 PropHash hProp;
39 NodeHash hChildren; 60 GroupHash hChildren;
61 NodeList lChildren;
62 };
63
64 class TafProperty : public TafNode
65 {
66 public:
67 TafProperty( const Bu::FString &sName, const Bu::FString &sValue );
68 virtual ~TafProperty();
69
70 const Bu::FString &getName() const;
71 const Bu::FString &getValue() const;
72
73 private:
74 Bu::FString sName;
75 Bu::FString sValue;
76 };
77
78 class TafComment : public TafNode
79 {
80 public:
81 TafComment( const Bu::FString &sText );
82 virtual ~TafComment();
83
84 const Bu::FString &getText() const;
85
86 private:
87 Bu::FString sText;
40 }; 88 };
41} 89}
42 90