aboutsummaryrefslogtreecommitdiff
path: root/src/tafnode.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-06-07 04:55:29 +0000
committerMike Buland <eichlan@xagasoft.com>2007-06-07 04:55:29 +0000
commitc2e3879b965d297604804f03271ac71c8c5c81f3 (patch)
treee3abe738a7aca61fc0bfa88866d88b7d345258fd /src/tafnode.cpp
parent0e41e5b6c004f695013d65f71c4223e2540d1391 (diff)
downloadlibbu++-c2e3879b965d297604804f03271ac71c8c5c81f3.tar.gz
libbu++-c2e3879b965d297604804f03271ac71c8c5c81f3.tar.bz2
libbu++-c2e3879b965d297604804f03271ac71c8c5c81f3.tar.xz
libbu++-c2e3879b965d297604804f03271ac71c8c5c81f3.zip
The new taf interfaces seem to work just fine, except for saving and that loaded
TafNode structures are immutable, it all looks really good. Saving should be a snap, and the immutable part I'm not sure is bad...we'll see what happens. Also, I'm contemplating looking into a way to add "named data structure" support to the Archive at a lower level, then allow it to use a nameing system to apply names to each data structure and then output to any backend that supports naming, like taf, xml, etc.
Diffstat (limited to 'src/tafnode.cpp')
-rw-r--r--src/tafnode.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/tafnode.cpp b/src/tafnode.cpp
index ed8adc0..3060606 100644
--- a/src/tafnode.cpp
+++ b/src/tafnode.cpp
@@ -6,13 +6,13 @@ Bu::TafNode::TafNode()
6 6
7Bu::TafNode::~TafNode() 7Bu::TafNode::~TafNode()
8{ 8{
9 printf("Entering Bu::TafNode::~TafNode() \"%s\"\n", sName.getStr() ); 9 //printf("Entering Bu::TafNode::~TafNode() \"%s\"\n", sName.getStr() );
10 for( NodeHash::iterator i = hChildren.begin(); i != hChildren.end(); i++ ) 10 for( NodeHash::iterator i = hChildren.begin(); i != hChildren.end(); i++ )
11 { 11 {
12 NodeList &l = i.getValue(); 12 NodeList &l = i.getValue();
13 for( NodeList::iterator k = l.begin(); k != l.end(); k++ ) 13 for( NodeList::iterator k = l.begin(); k != l.end(); k++ )
14 { 14 {
15 printf("deleting: [%08X] %s\n", *k, "" );//(*k)->getName().getStr() ); 15 //printf("deleting: [%08X] %s\n", *k, "" );//(*k)->getName().getStr() );
16 delete (*k); 16 delete (*k);
17 } 17 }
18 } 18 }
@@ -35,27 +35,37 @@ void Bu::TafNode::addChild( TafNode *pNode )
35 hChildren.insert( pNode->getName(), NodeList() ); 35 hChildren.insert( pNode->getName(), NodeList() );
36 } 36 }
37 37
38 printf("Appending \"%s\"\n", pNode->getName().getStr() ); 38 //printf("Appending \"%s\"\n", pNode->getName().getStr() );
39 hChildren.get( pNode->getName() ).append( pNode ); 39 hChildren.get( pNode->getName() ).append( pNode );
40 printf("[%08X]\n", hChildren.get( pNode->getName() ).last() ); 40 //printf("[%08X]\n", hChildren.get( pNode->getName() ).last() );
41} 41}
42 42
43const Bu::TafNode::PropList &Bu::TafNode::getProperty( const Bu::FString &sName ) 43const Bu::TafNode::PropList &Bu::TafNode::getProperties( const Bu::FString &sName ) const
44{ 44{
45 return hProp.get( sName ); 45 return hProp.get( sName );
46} 46}
47 47
48const Bu::TafNode::NodeList &Bu::TafNode::getNode( const Bu::FString &sName ) 48const Bu::TafNode::NodeList &Bu::TafNode::getNodes( const Bu::FString &sName ) const
49{ 49{
50 return hChildren.get( sName ); 50 return hChildren.get( sName );
51} 51}
52 52
53const Bu::FString &Bu::TafNode::getProperty( const Bu::FString &sName ) const
54{
55 return getProperties( sName ).first();
56}
57
58const Bu::TafNode *Bu::TafNode::getNode( const Bu::FString &sName ) const
59{
60 return getNodes( sName ).first();
61}
62
53void Bu::TafNode::setName( const Bu::FString &sName ) 63void Bu::TafNode::setName( const Bu::FString &sName )
54{ 64{
55 this->sName = sName; 65 this->sName = sName;
56} 66}
57 67
58const Bu::FString &Bu::TafNode::getName() 68const Bu::FString &Bu::TafNode::getName() const
59{ 69{
60 return sName; 70 return sName;
61} 71}