Formatter for integral types. More...
#include <number.hpp>
Public Member Functions | |
FormatNumber< Number > & | align (ecl::Alignment a) |
FormatNumber< Number > & | base (ecl::IntegralBase b) |
FormatNumber (int w=-1, ecl::Alignment a=NoAlign, ecl::IntegralBase b=Dec) | |
FormatNumber< Number > & | operator() (int w, ecl::Alignment a, ecl::IntegralBase b) |
FormatNumber< Number > & | operator() (Number n) |
FormatNumber< Number > & | operator() (Number n, int w, ecl::Alignment a, ecl::IntegralBase b) |
FormatNumber< Number > & | operator() (Number n, int w, ecl::IntegralBase b) |
FormatNumber< Number > & | width (int w) |
virtual | ~FormatNumber () |
Protected Member Functions | |
template<typename OutputStream > | |
void | formatBin (OutputStream &ostream) const |
template<typename OutputStream > | |
void | formatDec (OutputStream &ostream) const |
template<typename OutputStream > | |
void | formatHex (OutputStream &ostream) const |
template<typename OutputStream > | |
void | pad (int n, OutputStream &ostream) const |
template<typename OutputStream > | |
void | postPad (int n, OutputStream &ostream) const |
template<typename OutputStream > | |
void | prePad (int n, OutputStream &ostream) const |
Protected Attributes | |
ecl::Alignment * | alignment_ |
IntegralBase * | base_ |
ecl::Alignment | prm_alignment |
ecl::IntegralBase | prm_base |
int | prm_width |
bool | ready_to_format |
ecl::Alignment | tmp_alignment |
ecl::IntegralBase | tmp_base |
int | tmp_width |
Number | value_ |
int * | width_ |
Friends | |
template<typename OutputStream , typename N > | |
OutputStream & | operator<< (OutputStream &ostream, FormatNumber< N > &formatter) |
Formatter for integral types.
Default formatter for integral types. For convenience, use the individual Format classes that inherit this one instead.
Definition at line 63 of file number.hpp.
|
inline |
Default constructor. Initialises the format tags for width, alignment and base.
w | : width (default - no width constraints) |
a | : the textual alignment (default - no alignment constraints) |
b | : the base format for the integral representation (default - decimal) |
Definition at line 76 of file number.hpp.
|
inlinevirtual |
Definition at line 78 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::align | ( | ecl::Alignment | a | ) |
Sets the alignment format parameter. This aligns the text output in the text window which has a width specified by the width parameter.
a | : the aligning property for the output text. |
Definition at line 209 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::base | ( | ecl::IntegralBase | b | ) |
Sets the base format. For integral types, this can be binary, hexadecimal or decimal.
b | : the base representation used for the output. |
Definition at line 192 of file number.hpp.
|
protected |
Definition at line 232 of file number.hpp.
|
protected |
Definition at line 263 of file number.hpp.
|
protected |
Definition at line 246 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::operator() | ( | int | w, |
ecl::Alignment | a, | ||
ecl::IntegralBase | b | ||
) |
Convenient stream format parameter setter. This one permanently configures the width alignment and base as specified.
w | : the total width of the text output. |
a | : the aligning property for the output text. |
b | : the base representation used for the output. |
Definition at line 219 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::operator() | ( | Number | n | ) |
Convenient stream formatter. This function directly formats the specified input value with the stored settings.
n | : the input value to be formatted. |
Insert an input value to be formatted when passed to a stream.
Definition at line 319 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::operator() | ( | Number | n, |
int | w, | ||
ecl::Alignment | a, | ||
ecl::IntegralBase | b | ||
) |
Convenient stream formatter. This member directly formats the specified input value with the supplied/temporary parameters.
n | : the input value to be formatted. |
w | : the total width of the text output. |
a | : the aligning property for the output text. |
b | : the base representation used for the output. |
Temporarily configure the formatter with a complete parameter set along with a value to be formatted.
Definition at line 349 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::operator() | ( | Number | n, |
int | w, | ||
ecl::IntegralBase | b | ||
) |
Convenient stream formatter. This member directly formats the specified input value with the supplied/temporary parameters.
n | : the input value to be formatted. |
w | : the total width of the text output. |
b | : the base representation used for the output. |
Temporarily configure the formatter with a width, base combination along with a value to be formatted.
Definition at line 334 of file number.hpp.
|
protected |
Definition at line 305 of file number.hpp.
|
protected |
Definition at line 290 of file number.hpp.
|
protected |
Definition at line 275 of file number.hpp.
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::width | ( | int | w | ) |
Sets the width format parameter. Setting this to -1 will turn off width formatting constraints.
w | : the total width of the text output. |
Definition at line 199 of file number.hpp.
|
friend |
Friend function which allows a stream to act on the formatter to produce the formatted result. This works on normal c++ streams as well as TextStreams.
ostream | : the stream. |
formatter | : the formatter with prespecified format parameters and input value. |
StandardException | : throws if the formatter is used multiply in one stream operation [debug mode only]. |
Definition at line 367 of file number.hpp.
|
protected |
Definition at line 170 of file number.hpp.
|
protected |
Definition at line 170 of file number.hpp.
|
protected |
Definition at line 167 of file number.hpp.
|
protected |
Definition at line 168 of file number.hpp.
|
protected |
Definition at line 166 of file number.hpp.
|
protected |
Definition at line 171 of file number.hpp.
|
protected |
Definition at line 167 of file number.hpp.
|
protected |
Definition at line 168 of file number.hpp.
|
protected |
Definition at line 166 of file number.hpp.
|
protected |
Definition at line 172 of file number.hpp.
|
protected |
Definition at line 169 of file number.hpp.