diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-10-16 12:59:45 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-10-16 12:59:45 +0000 |
commit | 96b07a22f5392f5d7f821f5743deb3d64bd94e89 (patch) | |
tree | f8610916735e2bc5304031168f724cde7d909653 /src/tafgroup.h | |
parent | 835c3420326a3a3a94baa8690bf09941182d29b0 (diff) | |
download | libbu++-96b07a22f5392f5d7f821f5743deb3d64bd94e89.tar.gz libbu++-96b07a22f5392f5d7f821f5743deb3d64bd94e89.tar.bz2 libbu++-96b07a22f5392f5d7f821f5743deb3d64bd94e89.tar.xz libbu++-96b07a22f5392f5d7f821f5743deb3d64bd94e89.zip |
Although this looks like a load of code changes, this represents no functional
change to the Taf system. Really all that's happened is I've broken out the
core taf data types into seperate files, and gone ahead and created a helpful
new header file ("taf.h") that will include the entire taf system, including
the reader and writer for you.
This means that a lot of programs will start complaining, but fortunately,
there's an easy solution, if it complains about taf, make sure to include taf.h
at the top, instead of other taf files and you'll be set.
The next set of changes will add lots of helpers to the taf system and change
the reader to read non-const structures, i.e. I'll actually add editing support
to created taf structures.
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 | ||