From c2e3879b965d297604804f03271ac71c8c5c81f3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 7 Jun 2007 04:55:29 +0000 Subject: 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. --- src/tafnode.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/tafnode.cpp') 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() Bu::TafNode::~TafNode() { - printf("Entering Bu::TafNode::~TafNode() \"%s\"\n", sName.getStr() ); + //printf("Entering Bu::TafNode::~TafNode() \"%s\"\n", sName.getStr() ); for( NodeHash::iterator i = hChildren.begin(); i != hChildren.end(); i++ ) { NodeList &l = i.getValue(); for( NodeList::iterator k = l.begin(); k != l.end(); k++ ) { - printf("deleting: [%08X] %s\n", *k, "" );//(*k)->getName().getStr() ); + //printf("deleting: [%08X] %s\n", *k, "" );//(*k)->getName().getStr() ); delete (*k); } } @@ -35,27 +35,37 @@ void Bu::TafNode::addChild( TafNode *pNode ) hChildren.insert( pNode->getName(), NodeList() ); } - printf("Appending \"%s\"\n", pNode->getName().getStr() ); + //printf("Appending \"%s\"\n", pNode->getName().getStr() ); hChildren.get( pNode->getName() ).append( pNode ); - printf("[%08X]\n", hChildren.get( pNode->getName() ).last() ); + //printf("[%08X]\n", hChildren.get( pNode->getName() ).last() ); } -const Bu::TafNode::PropList &Bu::TafNode::getProperty( const Bu::FString &sName ) +const Bu::TafNode::PropList &Bu::TafNode::getProperties( const Bu::FString &sName ) const { return hProp.get( sName ); } -const Bu::TafNode::NodeList &Bu::TafNode::getNode( const Bu::FString &sName ) +const Bu::TafNode::NodeList &Bu::TafNode::getNodes( const Bu::FString &sName ) const { return hChildren.get( sName ); } +const Bu::FString &Bu::TafNode::getProperty( const Bu::FString &sName ) const +{ + return getProperties( sName ).first(); +} + +const Bu::TafNode *Bu::TafNode::getNode( const Bu::FString &sName ) const +{ + return getNodes( sName ).first(); +} + void Bu::TafNode::setName( const Bu::FString &sName ) { this->sName = sName; } -const Bu::FString &Bu::TafNode::getName() +const Bu::FString &Bu::TafNode::getName() const { return sName; } -- cgit v1.2.3