aboutsummaryrefslogtreecommitdiff
path: root/src/formatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/formatter.cpp28
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
12Bu::Formatter::Formatter( Stream &rStream ) : 13Bu::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
192Bu::Formatter::Fmt &Bu::Formatter::Fmt::width( unsigned int uWidth ) 193void Bu::Formatter::doFlush()
194{
195 rStream.flush();
196}
197
198Bu::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
198Bu::Formatter::Fmt &Bu::Formatter::Fmt::fill( char cFill ) 204Bu::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
204Bu::Formatter::Fmt &Bu::Formatter::Fmt::radix( unsigned int uRadix ) 210Bu::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
210Bu::Formatter::Fmt &Bu::Formatter::Fmt::align( Alignment eAlign ) 216Bu::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
216Bu::Formatter::Fmt &Bu::Formatter::Fmt::left() 222Bu::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
222Bu::Formatter::Fmt &Bu::Formatter::Fmt::center() 228Bu::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
228Bu::Formatter::Fmt &Bu::Formatter::Fmt::right() 234Bu::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
234Bu::Formatter::Fmt &Bu::Formatter::Fmt::plus( bool bPlus ) 240Bu::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
240Bu::Formatter::Fmt &Bu::Formatter::Fmt::caps( bool bCaps ) 246Bu::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
246Bu::Formatter::Fmt &Bu::Formatter::Fmt::tokenize( bool bTokenize ) 252Bu::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
252Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Formatter::Fmt &fmt ) 258Bu::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;