aboutsummaryrefslogtreecommitdiff
path: root/src/tafwriter.cpp
blob: ac42d3d74d640eb4d182064f7849ce489513cf40 (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
#include "tafwriter.h"

Bu::TafWriter::TafWriter( Bu::Stream &sOut ) :
	sOut( sOut )
{
}

Bu::TafWriter::~TafWriter()
{
}

void Bu::TafWriter::writeNode( Bu::TafNode *pRoot )
{
	sOut.write("{", 1 );
	writeString( pRoot->getName().getStr() );
	sOut.write(": ", 2 );
	sOut.write("}", 1 );
}

void Bu::TafWriter::writeString( const Bu::FString &str )
{
	sOut.write("\"", 1 );
	for( const char *s = str.getStr(); *s; s++ )
	{
		if( *s == '\"' )
			sOut.write("\\\"", 2 );
		else
			sOut.write( s, 1 );
	}
	sOut.write("\"", 1 );
}