summaryrefslogtreecommitdiff
path: root/src/tafnode.cpp
diff options
context:
space:
mode:
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