Debian Codegraph @

src/lisp/writer.hpp

raw symbols SCIP
1 // $Id: writer.hpp 848 2006-10-29 02:14:04Z coz $
2 //
3 // TuxKart - a fun racing game with go-kart
4 // Copyright (C) 2004 Matthias Braun <[email protected]>
5 // code in this file based on lispreader from Mark Probst
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __LISPWRITER_H__
21 #define __LISPWRITER_H__
22
23 #include <iostream>
24 #include <string>
25 #include <vector>
26
27 namespace lisp
28 {
29
30 class Writer
31 {
32 public:
33 Writer(const std::string& filename);
34 Writer(std::ostream& out);
35 ~Writer();
36
37 void writeComment(const std::string& comment);
38
39 void beginList(const std::string& listname);
40
41 void write(const std::string& name, int value);
42 void write(const std::string& name, unsigned int value) {write(name, (int)value);}
43 void write(const std::string& name, float value);
44 void write(const std::string& name, const std::string& value);
45 void write(const std::string& name, const char* value);
46 void write(const std::string& name, bool value);
47 void write(const std::string& name, const std::vector<int>& value);
48 void write(const std::string& name, const std::vector<unsigned int>& value);
49 // add more write-functions when needed...
50
51 void endList(const std::string& listname);
52
53 private:
54 void indent();
55
56 bool m_owner;
57 std::ostream* m_out;
58 int m_indent_depth;
59 std::vector<std::string> m_lists;
60 };
61
62 } //namespace lisp
63
64 #endif
65