3 This file is part of libmspdatafile
4 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
9 #include "textwriter.h"
16 TextWriter::TextWriter(ostream &o):
20 void TextWriter::write(const Statement &st)
25 void TextWriter::write_(const Statement &st, unsigned level)
27 string indent(level, '\t');
29 out<<indent<<st.keyword;
30 for(ValueArray::const_iterator i=st.args.begin(); i!=st.args.end(); ++i)
33 if(i->get_type()==STRING)
34 out<<'\"'<<i->get_raw()<<'\"';
35 else if(i->get_type()==BOOLEAN)
36 out<<(i->get<bool>() ? "true" : "false");
42 out<<'\n'<<indent<<"{\n";
43 for(list<Statement>::const_iterator i=st.sub.begin(); i!=st.sub.end(); ++i)
50 } // namespace DataFile