Atlas  0.7.0
Networking protocol for the Worldforge system.
MultiLineListFormatter.cpp
1 // Copyright (C) 2009 Alistair Riddoch
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software Foundation,
15 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #include "MultiLineListFormatter.h"
18 
19 #include <iostream>
20 
21 namespace Atlas
22 {
23 
24 MultiLineListFormatter::MultiLineListFormatter(std::ostream & s, Bridge & b) :
25  Formatter(s, b)
26 {
27 }
28 
29 void MultiLineListFormatter::mapListItem(std::string name)
30 {
31  Formatter::mapListItem(name);
32  m_indent += m_spacing;
33  m_stream << std::endl;
34 }
35 
36 void MultiLineListFormatter::listMapItem()
37 {
38  Formatter::listMapItem();
39 }
40 
41 void MultiLineListFormatter::listListItem()
42 {
43  m_stream << std::string(m_indent, ' ');
44  Formatter::listListItem();
45  m_indent += m_spacing;
46  m_stream << std::endl;
47 }
48 
49 void MultiLineListFormatter::listIntItem(std::int64_t l)
50 {
51  m_stream << std::string(m_indent, ' ');
52  Formatter::listIntItem(l);
53  m_stream << std::endl;
54 }
55 
56 void MultiLineListFormatter::listFloatItem(double d)
57 {
58  m_stream << std::string(m_indent, ' ');
59  Formatter::listFloatItem(d);
60  m_stream << std::endl;
61 }
62 
63 void MultiLineListFormatter::listStringItem(std::string s)
64 {
65  m_stream << std::string(m_indent, ' ');
66  Formatter::listStringItem(s);
67  m_stream << std::endl;
68 }
69 
70 void MultiLineListFormatter::listNoneItem()
71 {
72  m_stream << std::string(m_indent, ' ');
73  Formatter::listNoneItem();
74  m_stream << std::endl;
75 }
76 
77 void MultiLineListFormatter::listEnd()
78 {
79  m_indent -= m_spacing;
80  m_stream << std::string(m_indent, ' ');
81  Formatter::listEnd();
82 }
83 }
Definition: Bridge.h:21