summaryrefslogtreecommitdiff
path: root/src/tafnode.cpp
blob: ed8adc0e8820e3ac69e09e5661d993f4b2595a87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "tafnode.h"

Bu::TafNode::TafNode()
{
}

Bu::TafNode::~TafNode()
{
	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() );
			delete (*k);
		}
	}
}

void Bu::TafNode::setProperty( Bu::FString sName, Bu::FString sValue )
{
	if( !hProp.has( sName ) )
	{
		hProp.insert( sName, PropList() );
	}

	hProp.get( sName ).append( sValue );
}

void Bu::TafNode::addChild( TafNode *pNode )
{
	if( !hChildren.has( pNode->getName() ) )
	{
		hChildren.insert( pNode->getName(), NodeList() );
	}

	printf("Appending \"%s\"\n", pNode->getName().getStr() );
	hChildren.get( pNode->getName() ).append( pNode );
	printf("[%08X]\n", hChildren.get( pNode->getName() ).last() );
}

const Bu::TafNode::PropList &Bu::TafNode::getProperty( const Bu::FString &sName )
{
	return hProp.get( sName );
}

const Bu::TafNode::NodeList &Bu::TafNode::getNode( const Bu::FString &sName )
{
	return hChildren.get( sName );
}

void Bu::TafNode::setName( const Bu::FString &sName )
{
	this->sName = sName;
}

const Bu::FString &Bu::TafNode::getName()
{
	return sName;
}