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::IntegralBase b) |
FormatNumber< Number > & | operator() (Number n, int w, ecl::Alignment a, 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 57 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 68 of file number.hpp.
|
inlinevirtual |
Definition at line 70 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 203 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 186 of file number.hpp.
|
protected |
Definition at line 226 of file number.hpp.
|
protected |
Definition at line 257 of file number.hpp.
|
protected |
Definition at line 240 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 213 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 313 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 328 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 343 of file number.hpp.
|
protected |
Definition at line 299 of file number.hpp.
|
protected |
Definition at line 284 of file number.hpp.
|
protected |
Definition at line 269 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 193 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 361 of file number.hpp.
|
protected |
Definition at line 162 of file number.hpp.
|
protected |
Definition at line 162 of file number.hpp.
|
protected |
Definition at line 159 of file number.hpp.
|
protected |
Definition at line 160 of file number.hpp.
|
protected |
Definition at line 158 of file number.hpp.
|
protected |
Definition at line 163 of file number.hpp.
|
protected |
Definition at line 159 of file number.hpp.
|
protected |
Definition at line 160 of file number.hpp.
|
protected |
Definition at line 158 of file number.hpp.
|
protected |
Definition at line 164 of file number.hpp.
|
protected |
Definition at line 161 of file number.hpp.