From c84fe052b8bdeb0638d2c71e99e8fe992f5af647 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 27 Jun 2007 23:15:25 +0000 Subject: Ooooh, more Taf-goodness. --- src/tafnode.cpp | 39 +++++++++++++++++++++++++++------------ src/tafnode.h | 3 +++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/tafnode.cpp b/src/tafnode.cpp index 7e171c9..53b782e 100644 --- a/src/tafnode.cpp +++ b/src/tafnode.cpp @@ -61,29 +61,44 @@ Bu::TafNode *Bu::TafGroup::addChild( Bu::TafNode *pNode ) switch( pNode->getType() ) { case typeGroup: - { - TafGroup *pGroup = (TafGroup *)pNode; - if( !hChildren.has( pGroup->getName() ) ) - hChildren.insert( pGroup->getName(), GroupList() ); - hChildren.get( pGroup->getName() ).append( pGroup ); - } + addChild( (Bu::TafGroup *)pNode ); break; case typeProperty: - { - TafProperty *pProperty = (TafProperty *)pNode; - if( !hProp.has( pProperty->getName() ) ) - hProp.insert( pProperty->getName(), PropList() ); - hProp.get( pProperty->getName() ).append( pProperty->getValue() ); - } + addChild( (Bu::TafProperty *)pNode ); break; case typeComment: + addChild( (Bu::TafComment *)pNode ); break; } + return pNode; +} + +Bu::TafGroup *Bu::TafGroup::addChild( TafGroup *pNode ) +{ + TafGroup *pGroup = (TafGroup *)pNode; + if( !hChildren.has( pGroup->getName() ) ) + hChildren.insert( pGroup->getName(), GroupList() ); + hChildren.get( pGroup->getName() ).append( pGroup ); lChildren.append( pNode ); + return pNode; +} +Bu::TafProperty *Bu::TafGroup::addChild( TafProperty *pNode ) +{ + TafProperty *pProperty = (TafProperty *)pNode; + if( !hProp.has( pProperty->getName() ) ) + hProp.insert( pProperty->getName(), PropList() ); + hProp.get( pProperty->getName() ).append( pProperty->getValue() ); + lChildren.append( pNode ); + return pNode; +} + +Bu::TafComment *Bu::TafGroup::addChild( TafComment *pNode ) +{ + lChildren.append( pNode ); return pNode; } diff --git a/src/tafnode.h b/src/tafnode.h index 0fdcba7..cb4093f 100644 --- a/src/tafnode.h +++ b/src/tafnode.h @@ -52,6 +52,9 @@ namespace Bu const TafGroup *getChild( const Bu::FString &sName ) const; const GroupList &getChildren( const Bu::FString &sName ) const; TafNode *addChild( TafNode *pNode ); + TafGroup *addChild( TafGroup *pNode ); + TafProperty *addChild( TafProperty *pNode ); + TafComment *addChild( TafComment *pNode ); const NodeList &getChildren() const; private: -- cgit v1.2.3