diff options
Diffstat (limited to 'src/tafgroup.h')
-rw-r--r-- | src/tafgroup.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/tafgroup.h b/src/tafgroup.h new file mode 100644 index 0000000..6a50d11 --- /dev/null +++ b/src/tafgroup.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2008 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_TAF_GROUP_H | ||
9 | #define BU_TAF_GROUP_H | ||
10 | |||
11 | #include <stdint.h> | ||
12 | #include "bu/tafnode.h" | ||
13 | #include "bu/fstring.h" | ||
14 | #include "bu/hash.h" | ||
15 | #include "bu/list.h" | ||
16 | |||
17 | namespace Bu | ||
18 | { | ||
19 | class TafProperty; | ||
20 | class TafComment; | ||
21 | /** | ||
22 | * | ||
23 | *@ingroup Taf | ||
24 | */ | ||
25 | class TafGroup : public TafNode | ||
26 | { | ||
27 | public: | ||
28 | typedef Bu::List<Bu::FString> PropList; | ||
29 | typedef Bu::Hash<Bu::FString, PropList> PropHash; | ||
30 | typedef Bu::List<class Bu::TafGroup *> GroupList; | ||
31 | typedef Bu::Hash<Bu::FString, GroupList> GroupHash; | ||
32 | typedef Bu::List<class Bu::TafNode *> NodeList; | ||
33 | |||
34 | TafGroup( const Bu::FString &sName ); | ||
35 | virtual ~TafGroup(); | ||
36 | |||
37 | const Bu::FString &getName() const; | ||
38 | void setName( const Bu::FString &sName ); | ||
39 | |||
40 | bool hasProperty( const Bu::FString &sName ) const; | ||
41 | const Bu::FString &getProperty( const Bu::FString &sName ) const; | ||
42 | const Bu::FString &getProperty( const Bu::FString &sName, | ||
43 | const Bu::FString &sDef ) const; | ||
44 | const PropList &getProperties( const Bu::FString &sName ) const; | ||
45 | bool hasChild( const Bu::FString &sName ) const; | ||
46 | const TafGroup *getChild( const Bu::FString &sName ) const; | ||
47 | const GroupList &getChildren( const Bu::FString &sName ) const; | ||
48 | TafNode *addChild( TafNode *pNode ); | ||
49 | TafGroup *addChild( TafGroup *pNode ); | ||
50 | TafProperty *addChild( TafProperty *pNode ); | ||
51 | TafComment *addChild( TafComment *pNode ); | ||
52 | TafGroup *addGroup( const Bu::FString &sName ); | ||
53 | TafProperty *addProperty( | ||
54 | const Bu::FString &sName, const Bu::FString &sValue ); | ||
55 | const NodeList &getChildren() const; | ||
56 | |||
57 | private: | ||
58 | Bu::FString sName; | ||
59 | PropHash hProp; | ||
60 | GroupHash hChildren; | ||
61 | NodeList lChildren; | ||
62 | }; | ||
63 | } | ||
64 | |||
65 | #endif | ||