diff options
Diffstat (limited to '')
-rw-r--r-- | src/tafwriter.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/tafwriter.cpp b/src/tafwriter.cpp index 3e6c025..ac42d3d 100644 --- a/src/tafwriter.cpp +++ b/src/tafwriter.cpp | |||
@@ -1,9 +1,32 @@ | |||
1 | #include "tafwriter.h" | 1 | #include "tafwriter.h" |
2 | 2 | ||
3 | Bu::TafWriter::TafWriter() | 3 | Bu::TafWriter::TafWriter( Bu::Stream &sOut ) : |
4 | sOut( sOut ) | ||
4 | { | 5 | { |
5 | } | 6 | } |
6 | 7 | ||
7 | Bu::TafWriter::~TafWriter() | 8 | Bu::TafWriter::~TafWriter() |
8 | { | 9 | { |
9 | } | 10 | } |
11 | |||
12 | void Bu::TafWriter::writeNode( Bu::TafNode *pRoot ) | ||
13 | { | ||
14 | sOut.write("{", 1 ); | ||
15 | writeString( pRoot->getName().getStr() ); | ||
16 | sOut.write(": ", 2 ); | ||
17 | sOut.write("}", 1 ); | ||
18 | } | ||
19 | |||
20 | void Bu::TafWriter::writeString( const Bu::FString &str ) | ||
21 | { | ||
22 | sOut.write("\"", 1 ); | ||
23 | for( const char *s = str.getStr(); *s; s++ ) | ||
24 | { | ||
25 | if( *s == '\"' ) | ||
26 | sOut.write("\\\"", 2 ); | ||
27 | else | ||
28 | sOut.write( s, 1 ); | ||
29 | } | ||
30 | sOut.write("\"", 1 ); | ||
31 | } | ||
32 | |||