Fix documentation build under maverick (doxygen 1.7.1)
[senf.git] / senf / Utils / Format.cci
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief Format inline non-template implementation */
25
26 #include "Format.ih"
27
28 // Custom includes
29
30 #define prefix_ inline
31 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32
33 //-/////////////////////////////////////////////////////////////////////////////////////////////////
34 // senf::format::eng
35
36 prefix_ senf::format::eng::eng(float v, float d)
37     : v_ (v), d_ (d), haveWidth_ (false), width_ (0), havePrecision_ (false), precision_ (0),
38       haveFill_ (false), fill_ (' '), mask_ (), flags_ ()
39 {}
40
41 prefix_ senf::format::eng const & senf::format::eng::setw(unsigned w)
42     const
43 {
44     haveWidth_ = true;
45     width_ = w;
46     return *this;
47 }
48
49 prefix_ senf::format::eng const & senf::format::eng::setprecision(unsigned p)
50     const
51 {
52     havePrecision_ = true;
53     precision_ = p;
54     return *this;
55 }
56
57 prefix_ senf::format::eng const & senf::format::eng::setfill(char c)
58     const
59 {
60     haveFill_ = true;
61     fill_ = c;
62     return *this;
63 }
64
65 prefix_ senf::format::eng const & senf::format::eng::showbase()
66     const
67 {
68     mask_ |= std::ios_base::showbase;
69     flags_ |= std::ios_base::showbase;
70     return *this;
71 }
72
73 prefix_ senf::format::eng const & senf::format::eng::noshowbase()
74     const
75 {
76     mask_ |= std::ios_base::showbase;
77     flags_ &= ~std::ios_base::showbase;
78     return *this;
79 }
80
81 prefix_ senf::format::eng const & senf::format::eng::showpos()
82     const
83 {
84     mask_ |= std::ios_base::showpos;
85     flags_ |= std::ios_base::showpos;
86     return *this;
87 }
88
89 prefix_ senf::format::eng const & senf::format::eng::noshowpos()
90     const
91 {
92     mask_ |= std::ios_base::showpos;
93     flags_ &= ~std::ios_base::showpos;
94     return *this;
95 }
96
97 prefix_ senf::format::eng const & senf::format::eng::showpoint()
98     const
99 {
100     mask_ |= std::ios_base::showpoint;
101     flags_ |= std::ios_base::showpoint;
102     return *this;
103 }
104
105 prefix_ senf::format::eng const & senf::format::eng::noshowpoint()
106     const
107 {
108     mask_ |= std::ios_base::showpoint;
109     flags_ &= ~std::ios_base::showpoint;
110     return *this;
111 }
112
113 prefix_ senf::format::eng const & senf::format::eng::uppercase()
114     const
115 {
116     mask_ |= std::ios_base::uppercase;
117     flags_ |= std::ios_base::uppercase;
118     return *this;
119 }
120
121 prefix_ senf::format::eng const & senf::format::eng::nouppercase()
122     const
123 {
124     mask_ |= std::ios_base::uppercase;
125     flags_ &= ~std::ios_base::uppercase;
126     return *this;
127 }
128
129 prefix_ senf::format::eng const & senf::format::eng::left()
130     const
131 {
132     mask_ |= std::ios_base::adjustfield;
133     flags_ &= ~std::ios_base::adjustfield;
134     flags_ |= std::ios_base::left;
135     return *this;
136 }
137
138 prefix_ senf::format::eng const & senf::format::eng::internal()
139     const
140 {
141     mask_ |= std::ios_base::adjustfield;
142     flags_ &= ~std::ios_base::adjustfield;
143     flags_ |= std::ios_base::internal;
144     return *this;
145 }
146
147 prefix_ senf::format::eng const & senf::format::eng::right()
148     const
149 {
150     mask_ |= std::ios_base::adjustfield;
151     flags_ &= ~std::ios_base::adjustfield;
152     flags_ |= std::ios_base::right;
153     return *this;
154 }
155
156 //-/////////////////////////////////////////////////////////////////////////////////////////////////
157 // senf::format::IndentHelper
158
159 prefix_ senf::format::IndentHelper::IndentHelper()
160     : instance_level(1)
161 {
162     ++static_level;
163 }
164
165 prefix_ senf::format::IndentHelper::~IndentHelper()
166 {
167     static_level -= instance_level;
168 }
169
170 prefix_ void senf::format::IndentHelper::increase()
171 {
172     ++static_level;
173     ++instance_level;
174 }
175
176 prefix_ unsigned int senf::format::IndentHelper::level()
177     const
178 {
179     return static_level;
180 }
181
182 prefix_ std::ostream & senf::format::operator<<(std::ostream & os, senf::format::IndentHelper const & indent)
183 {
184     for (unsigned int i=0, j=indent.level(); i<j; ++i)
185         os << "  ";
186     return os;
187 }
188
189
190
191
192
193
194 //-/////////////////////////////////////////////////////////////////////////////////////////////////
195 #undef prefix_
196
197 \f
198 // Local Variables:
199 // mode: c++
200 // fill-column: 100
201 // comment-column: 40
202 // c-file-style: "senf"
203 // indent-tabs-mode: nil
204 // ispell-local-dictionary: "american"
205 // compile-command: "scons -u test"
206 // End: