diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-06-07 03:26:43 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-06-07 03:26:43 +0000 |
commit | 8b598e8436a7110abbd0a7566138bcaa952bb527 (patch) | |
tree | 9939beb03fb606e3f9dc3ff8ac04ed3725008ac6 /src/tafnode.cpp | |
parent | 1f785c99b4e9e76d6803bd66cc4256e9b03fa788 (diff) | |
download | libbu++-8b598e8436a7110abbd0a7566138bcaa952bb527.tar.gz libbu++-8b598e8436a7110abbd0a7566138bcaa952bb527.tar.bz2 libbu++-8b598e8436a7110abbd0a7566138bcaa952bb527.tar.xz libbu++-8b598e8436a7110abbd0a7566138bcaa952bb527.zip |
Except for an excessive amount of debug info, I finally got the delete code
working. Now you can load Taf structures and clean up, you just can't access
all of the data inside 100%.
Diffstat (limited to '')
-rw-r--r-- | src/tafnode.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/tafnode.cpp b/src/tafnode.cpp index 01880d9..ed8adc0 100644 --- a/src/tafnode.cpp +++ b/src/tafnode.cpp | |||
@@ -6,11 +6,21 @@ Bu::TafNode::TafNode() | |||
6 | 6 | ||
7 | Bu::TafNode::~TafNode() | 7 | Bu::TafNode::~TafNode() |
8 | { | 8 | { |
9 | printf("Entering Bu::TafNode::~TafNode() \"%s\"\n", sName.getStr() ); | ||
10 | for( NodeHash::iterator i = hChildren.begin(); i != hChildren.end(); i++ ) | ||
11 | { | ||
12 | NodeList &l = i.getValue(); | ||
13 | for( NodeList::iterator k = l.begin(); k != l.end(); k++ ) | ||
14 | { | ||
15 | printf("deleting: [%08X] %s\n", *k, "" );//(*k)->getName().getStr() ); | ||
16 | delete (*k); | ||
17 | } | ||
18 | } | ||
9 | } | 19 | } |
10 | 20 | ||
11 | void Bu::TafNode::setProperty( Bu::FString sName, Bu::FString sValue ) | 21 | void Bu::TafNode::setProperty( Bu::FString sName, Bu::FString sValue ) |
12 | { | 22 | { |
13 | if( hProp.has( sName ) ) | 23 | if( !hProp.has( sName ) ) |
14 | { | 24 | { |
15 | hProp.insert( sName, PropList() ); | 25 | hProp.insert( sName, PropList() ); |
16 | } | 26 | } |
@@ -18,8 +28,35 @@ void Bu::TafNode::setProperty( Bu::FString sName, Bu::FString sValue ) | |||
18 | hProp.get( sName ).append( sValue ); | 28 | hProp.get( sName ).append( sValue ); |
19 | } | 29 | } |
20 | 30 | ||
31 | void Bu::TafNode::addChild( TafNode *pNode ) | ||
32 | { | ||
33 | if( !hChildren.has( pNode->getName() ) ) | ||
34 | { | ||
35 | hChildren.insert( pNode->getName(), NodeList() ); | ||
36 | } | ||
37 | |||
38 | printf("Appending \"%s\"\n", pNode->getName().getStr() ); | ||
39 | hChildren.get( pNode->getName() ).append( pNode ); | ||
40 | printf("[%08X]\n", hChildren.get( pNode->getName() ).last() ); | ||
41 | } | ||
42 | |||
21 | const Bu::TafNode::PropList &Bu::TafNode::getProperty( const Bu::FString &sName ) | 43 | const Bu::TafNode::PropList &Bu::TafNode::getProperty( const Bu::FString &sName ) |
22 | { | 44 | { |
23 | return hProp.get( sName ); | 45 | return hProp.get( sName ); |
24 | } | 46 | } |
25 | 47 | ||
48 | const Bu::TafNode::NodeList &Bu::TafNode::getNode( const Bu::FString &sName ) | ||
49 | { | ||
50 | return hChildren.get( sName ); | ||
51 | } | ||
52 | |||
53 | void Bu::TafNode::setName( const Bu::FString &sName ) | ||
54 | { | ||
55 | this->sName = sName; | ||
56 | } | ||
57 | |||
58 | const Bu::FString &Bu::TafNode::getName() | ||
59 | { | ||
60 | return sName; | ||
61 | } | ||
62 | |||