diff options
Diffstat (limited to '')
-rw-r--r-- | src/formatter.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/formatter.cpp b/src/formatter.cpp index f73d46e..dcaa3a5 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include "bu/formatter.h" | 8 | #include "bu/formatter.h" |
9 | 9 | ||
10 | #include "bu/stream.h" | ||
10 | #include <string.h> | 11 | #include <string.h> |
11 | 12 | ||
12 | Bu::Formatter::Formatter( Stream &rStream ) : | 13 | Bu::Formatter::Formatter( Stream &rStream ) : |
@@ -189,67 +190,72 @@ void Bu::Formatter::setIndentChar( char cIndent ) | |||
189 | this->cIndent = cIndent; | 190 | this->cIndent = cIndent; |
190 | } | 191 | } |
191 | 192 | ||
192 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::width( unsigned int uWidth ) | 193 | void Bu::Formatter::doFlush() |
194 | { | ||
195 | rStream.flush(); | ||
196 | } | ||
197 | |||
198 | Bu::Fmt &Bu::Fmt::width( unsigned int uWidth ) | ||
193 | { | 199 | { |
194 | this->uMinWidth = uWidth; | 200 | this->uMinWidth = uWidth; |
195 | return *this; | 201 | return *this; |
196 | } | 202 | } |
197 | 203 | ||
198 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::fill( char cFill ) | 204 | Bu::Fmt &Bu::Fmt::fill( char cFill ) |
199 | { | 205 | { |
200 | this->cFillChar = (unsigned char)cFill; | 206 | this->cFillChar = (unsigned char)cFill; |
201 | return *this; | 207 | return *this; |
202 | } | 208 | } |
203 | 209 | ||
204 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::radix( unsigned int uRadix ) | 210 | Bu::Fmt &Bu::Fmt::radix( unsigned int uRadix ) |
205 | { | 211 | { |
206 | this->uRadix = uRadix; | 212 | this->uRadix = uRadix; |
207 | return *this; | 213 | return *this; |
208 | } | 214 | } |
209 | 215 | ||
210 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::align( Alignment eAlign ) | 216 | Bu::Fmt &Bu::Fmt::align( Alignment eAlign ) |
211 | { | 217 | { |
212 | this->uAlign = eAlign; | 218 | this->uAlign = eAlign; |
213 | return *this; | 219 | return *this; |
214 | } | 220 | } |
215 | 221 | ||
216 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::left() | 222 | Bu::Fmt &Bu::Fmt::left() |
217 | { | 223 | { |
218 | this->uAlign = Fmt::Left; | 224 | this->uAlign = Fmt::Left; |
219 | return *this; | 225 | return *this; |
220 | } | 226 | } |
221 | 227 | ||
222 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::center() | 228 | Bu::Fmt &Bu::Fmt::center() |
223 | { | 229 | { |
224 | this->uAlign = Fmt::Center; | 230 | this->uAlign = Fmt::Center; |
225 | return *this; | 231 | return *this; |
226 | } | 232 | } |
227 | 233 | ||
228 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::right() | 234 | Bu::Fmt &Bu::Fmt::right() |
229 | { | 235 | { |
230 | this->uAlign = Fmt::Right; | 236 | this->uAlign = Fmt::Right; |
231 | return *this; | 237 | return *this; |
232 | } | 238 | } |
233 | 239 | ||
234 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::plus( bool bPlus ) | 240 | Bu::Fmt &Bu::Fmt::plus( bool bPlus ) |
235 | { | 241 | { |
236 | this->bPlus = bPlus; | 242 | this->bPlus = bPlus; |
237 | return *this; | 243 | return *this; |
238 | } | 244 | } |
239 | 245 | ||
240 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::caps( bool bCaps ) | 246 | Bu::Fmt &Bu::Fmt::caps( bool bCaps ) |
241 | { | 247 | { |
242 | this->bCaps = bCaps; | 248 | this->bCaps = bCaps; |
243 | return *this; | 249 | return *this; |
244 | } | 250 | } |
245 | 251 | ||
246 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::tokenize( bool bTokenize ) | 252 | Bu::Fmt &Bu::Fmt::tokenize( bool bTokenize ) |
247 | { | 253 | { |
248 | this->bTokenize = bTokenize; | 254 | this->bTokenize = bTokenize; |
249 | return *this; | 255 | return *this; |
250 | } | 256 | } |
251 | 257 | ||
252 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Formatter::Fmt &fmt ) | 258 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Fmt &fmt ) |
253 | { | 259 | { |
254 | f.setTempFormat( fmt ); | 260 | f.setTempFormat( fmt ); |
255 | return f; | 261 | return f; |