aboutsummaryrefslogtreecommitdiff
path: root/src/tafnode.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-06-07 03:26:43 +0000
committerMike Buland <eichlan@xagasoft.com>2007-06-07 03:26:43 +0000
commit8b598e8436a7110abbd0a7566138bcaa952bb527 (patch)
tree9939beb03fb606e3f9dc3ff8ac04ed3725008ac6 /src/tafnode.cpp
parent1f785c99b4e9e76d6803bd66cc4256e9b03fa788 (diff)
downloadlibbu++-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 'src/tafnode.cpp')
-rw-r--r--src/tafnode.cpp39
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
7Bu::TafNode::~TafNode() 7Bu::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
11void Bu::TafNode::setProperty( Bu::FString sName, Bu::FString sValue ) 21void 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
31void 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
21const Bu::TafNode::PropList &Bu::TafNode::getProperty( const Bu::FString &sName ) 43const 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
48const Bu::TafNode::NodeList &Bu::TafNode::getNode( const Bu::FString &sName )
49{
50 return hChildren.get( sName );
51}
52
53void Bu::TafNode::setName( const Bu::FString &sName )
54{
55 this->sName = sName;
56}
57
58const Bu::FString &Bu::TafNode::getName()
59{
60 return sName;
61}
62