$search
Formatter for float types. More...
#include <floats.hpp>
Public Member Functions | |
| FormatFloat< Number > & | align (const ecl::Alignment a) |
| Sets the alignment format parameter. | |
| FormatFloat< Number > & | base (const ecl::FloatBase b) |
| Sets the base notation to use. | |
| FormatFloat (const int w=-1, const unsigned int p=4, const ecl::Alignment a=NoAlign, const ecl::FloatBase b=Fixed) | |
| FormatFloat< Number > & | operator() (const Number n, const unsigned int p, const int w, const ecl::Alignment align, const ecl::FloatBase b) |
| FormatFloat< Number > & | operator() (const Number n, const unsigned int p, const int w) |
| FormatFloat< Number > & | operator() (const Number n) |
| FormatFloat< Number > & | operator() (const unsigned int p, const int w, const ecl::Alignment align, const ecl::FloatBase b) |
| FormatFloat< Number > & | operator() (unsigned int p, const int w) |
| int | precision () |
| Returns the current precision setting. | |
| FormatFloat< Number > & | precision (const unsigned int p) |
| Sets the precision format parameter. | |
| int | width () |
| Returns the current precision setting. | |
| FormatFloat< Number > & | width (const int w) |
| Sets the width format parameter. | |
| virtual | ~FormatFloat () |
Protected Member Functions | |
| template<typename OutputStream > | |
| void | formatFixed (OutputStream &ostream) const |
| template<typename OutputStream > | |
| void | formatSci (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_ |
| ecl::FloatBase * | base_ |
| int * | precision_ |
| ecl::Alignment | prm_alignment |
| ecl::FloatBase | prm_base |
| int | prm_precision |
| int | prm_width |
| bool | ready_to_format |
| ecl::Alignment | tmp_alignment |
| ecl::FloatBase | tmp_base |
| int | tmp_precision |
| int | tmp_width |
| Number | value_ |
| int * | width_ |
Friends | |
| template<typename OutputStream , typename N > | |
| OutputStream & | operator<< (OutputStream &ostream, FormatFloat< N > &formatter) ecl_assert_throw_decl(StandardException) |
Formatter for float types.
Default formatter for float types. For convenience, use the individual Format<float|double> classes that inherit this one instead.
Definition at line 51 of file floats.hpp.
| ecl::interfaces::FormatFloat< Number >::FormatFloat | ( | const int | w = -1, |
|
| const unsigned int | p = 4, |
|||
| const ecl::Alignment | a = NoAlign, |
|||
| const ecl::FloatBase | b = Fixed | |||
| ) | [inline] |
Default constructor. Initialises the format tags for width, precision, alignment and base.
| w | : width (default - no width constraints) | |
| p | : the number of decimal places of precision (default - 4) | |
| a | : the textual alignment (default - no alignment constraints) | |
| b | : the base format for the floating point representation (default - fixed) |
Definition at line 63 of file floats.hpp.
| virtual ecl::interfaces::FormatFloat< Number >::~FormatFloat | ( | ) | [inline, virtual] |
Definition at line 74 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::align | ( | const ecl::Alignment | a | ) | [inline] |
Sets the alignment format parameter.
Sets the alignment format parameter.
| a | : the textual alignment. |
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 264 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::base | ( | const ecl::FloatBase | b | ) | [inline] |
Sets the base notation to use.
Sets the base notation to use (fixed or scientific).
| b | : the base format for the floating point representation. |
Sets the base format. For floating point values, this can be fixed, exponential or scientific.
| b | : the base representation used for the output. |
Definition at line 238 of file floats.hpp.
| void ecl::interfaces::FormatFloat< Number >::formatFixed | ( | OutputStream & | ostream | ) | const [inline, protected] |
Definition at line 355 of file floats.hpp.
| void ecl::interfaces::FormatFloat< Number >::formatSci | ( | OutputStream & | ostream | ) | const [inline, protected] |
Definition at line 387 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::operator() | ( | const Number | n, | |
| const unsigned int | p, | |||
| const int | w, | |||
| const ecl::Alignment | align, | |||
| const ecl::FloatBase | b | |||
| ) | [inline] |
Convenient stream formatter. This member directly formats the specified input value with the supplied/temporary parameters.
| n | : the input value to be formatted. | |
| p | : the number of decimal places of precision. | |
| w | : the total width of the text output. | |
| align | : the aligning property for the output text. | |
| b | : the base representation used for the output. |
Definition at line 330 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::operator() | ( | const Number | n, | |
| const unsigned int | p, | |||
| const int | w | |||
| ) | [inline] |
Convenient stream formatter. This member directly formats the specified input value with the supplied/temporary parameters.
| n | : the input value to be formatted. | |
| p | : the number of decimal places of precision. | |
| w | : the total width of the text output. |
Definition at line 310 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::operator() | ( | const Number | n | ) | [inline] |
Convenient stream formatter. This function directly formats the specified input value with the stored settings.
Format<float> format; cout << format(3,4)(3.5215233) << endl;
| n | : the input value to be formatted. |
Definition at line 300 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::operator() | ( | const unsigned int | p, | |
| const int | w, | |||
| const ecl::Alignment | align, | |||
| const ecl::FloatBase | b | |||
| ) | [inline] |
Convenient stream format parameter setter. This one permanently configures all parameters.
| p | : the number of decimal places of precision. | |
| w | : the total width of the text output. | |
| align | : the aligning property for the output text. | |
| b | : the base representation used for the output. |
Definition at line 287 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::operator() | ( | unsigned int | p, | |
| const int | w | |||
| ) | [inline] |
Convenient stream format parameter setter. This one permanently configures the width and precision as specified.
| p | : the number of decimal places of precision. | |
| w | : the total width of the text output. |
Definition at line 279 of file floats.hpp.
| void ecl::interfaces::FormatFloat< Number >::pad | ( | int | n, | |
| OutputStream & | ostream | |||
| ) | const [inline, protected] |
Definition at line 425 of file floats.hpp.
| void ecl::interfaces::FormatFloat< Number >::postPad | ( | int | n, | |
| OutputStream & | ostream | |||
| ) | const [inline, protected] |
Definition at line 410 of file floats.hpp.
| int ecl::interfaces::FormatFloat< Number >::precision | ( | ) | [inline] |
Returns the current precision setting.
Definition at line 123 of file floats.hpp.
| FormatFloat<Number>& ecl::interfaces::FormatFloat< Number >::precision | ( | const unsigned int | p | ) | [inline] |
Sets the precision format parameter.
Sets the precision format parameter.
| p | : the number of decimal places of precision. |
Definition at line 87 of file floats.hpp.
| void ecl::interfaces::FormatFloat< Number >::prePad | ( | int | n, | |
| OutputStream & | ostream | |||
| ) | const [inline, protected] |
Definition at line 395 of file floats.hpp.
| int ecl::interfaces::FormatFloat< Number >::width | ( | ) | [inline] |
Returns the current precision setting.
Definition at line 130 of file floats.hpp.
| FormatFloat< Number > & ecl::interfaces::FormatFloat< Number >::width | ( | const int | w | ) | [inline] |
Sets the width format parameter.
Sets the width format parameter.
| w | : the width to use for the inserted float (-1 is no width constraint). |
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 248 of file floats.hpp.
| OutputStream& operator<< | ( | OutputStream & | ostream, | |
| FormatFloat< N > & | formatter | |||
| ) | [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. |
Definition at line 437 of file floats.hpp.
ecl::Alignment* ecl::interfaces::FormatFloat< Number >::alignment_ [protected] |
Definition at line 210 of file floats.hpp.
ecl::FloatBase* ecl::interfaces::FormatFloat< Number >::base_ [protected] |
Definition at line 211 of file floats.hpp.
int * ecl::interfaces::FormatFloat< Number >::precision_ [protected] |
Definition at line 209 of file floats.hpp.
ecl::Alignment ecl::interfaces::FormatFloat< Number >::prm_alignment [protected] |
Definition at line 207 of file floats.hpp.
ecl::FloatBase ecl::interfaces::FormatFloat< Number >::prm_base [protected] |
Definition at line 208 of file floats.hpp.
int ecl::interfaces::FormatFloat< Number >::prm_precision [protected] |
Definition at line 206 of file floats.hpp.
int ecl::interfaces::FormatFloat< Number >::prm_width [protected] |
Definition at line 205 of file floats.hpp.
bool ecl::interfaces::FormatFloat< Number >::ready_to_format [protected] |
Definition at line 212 of file floats.hpp.
ecl::Alignment ecl::interfaces::FormatFloat< Number >::tmp_alignment [protected] |
Definition at line 207 of file floats.hpp.
ecl::FloatBase ecl::interfaces::FormatFloat< Number >::tmp_base [protected] |
Definition at line 208 of file floats.hpp.
int ecl::interfaces::FormatFloat< Number >::tmp_precision [protected] |
Definition at line 206 of file floats.hpp.
int ecl::interfaces::FormatFloat< Number >::tmp_width [protected] |
Definition at line 205 of file floats.hpp.
Number ecl::interfaces::FormatFloat< Number >::value_ [protected] |
Definition at line 213 of file floats.hpp.
int* ecl::interfaces::FormatFloat< Number >::width_ [protected] |
Definition at line 209 of file floats.hpp.