From d908cc68a7c3fe49814ba459f0ee33dc44decf5b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 21 May 2009 20:36:26 +0000 Subject: Added some more helpers to Bu::Formatter::Fmt, make it a little easier to use. --- src/formatter.cpp | 18 ++++++++++++++++++ src/formatter.h | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/formatter.cpp b/src/formatter.cpp index 8c06bde..dc4336b 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp @@ -153,6 +153,24 @@ Bu::Formatter::Fmt &Bu::Formatter::Fmt::align( Alignment eAlign ) return *this; } +Bu::Formatter::Fmt &Bu::Formatter::Fmt::left() +{ + this->uAlign = Fmt::Left; + return *this; +} + +Bu::Formatter::Fmt &Bu::Formatter::Fmt::center() +{ + this->uAlign = Fmt::Center; + return *this; +} + +Bu::Formatter::Fmt &Bu::Formatter::Fmt::right() +{ + this->uAlign = Fmt::Right; + return *this; +} + Bu::Formatter::Fmt &Bu::Formatter::Fmt::plus( bool bPlus ) { this->bPlus = bPlus; diff --git a/src/formatter.h b/src/formatter.h index 81e8db5..9f931ee 100644 --- a/src/formatter.h +++ b/src/formatter.h @@ -40,7 +40,7 @@ namespace Bu bCaps( bCaps ) { } - Fmt( unsigned int uMinWidth, Alignment a=Right, + Fmt( unsigned int uMinWidth, Alignment a, unsigned int uRadix=10, bool bPlus=false, bool bCaps=true, char cFill=' ') : uMinWidth( uMinWidth ), @@ -74,6 +74,10 @@ namespace Bu Fmt &plus( bool bPlus=true ); Fmt &caps( bool bCaps=true ); + Fmt &left(); + Fmt &right(); + Fmt ¢er(); + unsigned char uMinWidth; char cFillChar; unsigned short uRadix : 6; -- cgit v1.2.3