all unit tests: replaced BOOST_AUTO_UNIT_TEST with new SENF_AUTO_UNIT_TEST macro
[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 ///////////////////////////////cci.p///////////////////////////////////////
32
33 prefix_ senf::format::eng::eng(float v, float d)
34     : v_ (v), d_ (d), haveWidth_ (false), width_ (0), havePrecision_ (false), precision_ (0),
35       haveFill_ (false), fill_ (' '), mask_ (), flags_ ()
36 {}
37
38 prefix_ senf::format::eng const & senf::format::eng::setw(unsigned w)
39     const
40 {
41     haveWidth_ = true;
42     width_ = w;
43     return *this;
44 }
45
46 prefix_ senf::format::eng const & senf::format::eng::setprecision(unsigned p)
47     const
48 {
49     havePrecision_ = true;
50     precision_ = p;
51     return *this;
52 }
53
54 prefix_ senf::format::eng const & senf::format::eng::setfill(char c)
55     const
56 {
57     haveFill_ = true;
58     fill_ = c;
59     return *this;
60 }
61
62 prefix_ senf::format::eng const & senf::format::eng::showbase()
63     const
64 {
65     mask_ |= std::ios_base::showbase;
66     flags_ |= std::ios_base::showbase;
67     return *this;
68 }
69
70 prefix_ senf::format::eng const & senf::format::eng::noshowbase()
71     const
72 {
73     mask_ |= std::ios_base::showbase;
74     flags_ &= ~std::ios_base::showbase;
75     return *this;
76 }
77
78 prefix_ senf::format::eng const & senf::format::eng::showpos()
79     const
80 {
81     mask_ |= std::ios_base::showpos;
82     flags_ |= std::ios_base::showpos;
83     return *this;
84 }
85
86 prefix_ senf::format::eng const & senf::format::eng::noshowpos()
87     const
88 {
89     mask_ |= std::ios_base::showpos;
90     flags_ &= ~std::ios_base::showpos;
91     return *this;
92 }
93
94 prefix_ senf::format::eng const & senf::format::eng::showpoint()
95     const
96 {
97     mask_ |= std::ios_base::showpoint;
98     flags_ |= std::ios_base::showpoint;
99     return *this;
100 }
101
102 prefix_ senf::format::eng const & senf::format::eng::noshowpoint()
103     const
104 {
105     mask_ |= std::ios_base::showpoint;
106     flags_ &= ~std::ios_base::showpoint;
107     return *this;
108 }
109
110 prefix_ senf::format::eng const & senf::format::eng::uppercase()
111     const
112 {
113     mask_ |= std::ios_base::uppercase;
114     flags_ |= std::ios_base::uppercase;
115     return *this;
116 }
117
118 prefix_ senf::format::eng const & senf::format::eng::nouppercase()
119     const
120 {
121     mask_ |= std::ios_base::uppercase;
122     flags_ &= ~std::ios_base::uppercase;
123     return *this;
124 }
125
126 prefix_ senf::format::eng const & senf::format::eng::left()
127     const
128 {
129     mask_ |= std::ios_base::adjustfield;
130     flags_ &= ~std::ios_base::adjustfield;
131     flags_ |= std::ios_base::left;
132     return *this;
133 }
134
135 prefix_ senf::format::eng const & senf::format::eng::internal()
136     const
137 {
138     mask_ |= std::ios_base::adjustfield;
139     flags_ &= ~std::ios_base::adjustfield;
140     flags_ |= std::ios_base::internal;
141     return *this;
142 }
143
144 prefix_ senf::format::eng const & senf::format::eng::right()
145     const
146 {
147     mask_ |= std::ios_base::adjustfield;
148     flags_ &= ~std::ios_base::adjustfield;
149     flags_ |= std::ios_base::right;
150     return *this;
151 }
152
153 prefix_ std::ostream & senf::format::operator<<(std::ostream & os, senf::format::IndentHelper const & indent)
154 {
155     for (unsigned int i = 0; i < indent.static_level; ++i)
156         os << "  ";
157     return os;
158 }
159
160 ///////////////////////////////cci.e///////////////////////////////////////
161 #undef prefix_
162
163 \f
164 // Local Variables:
165 // mode: c++
166 // fill-column: 100
167 // comment-column: 40
168 // c-file-style: "senf"
169 // indent-tabs-mode: nil
170 // ispell-local-dictionary: "american"
171 // compile-command: "scons -u test"
172 // End: