Public Member Functions | Protected Member Functions | Protected Attributes | Friends
ecl::interfaces::FormatNumber< Number > Class Template Reference

Formatter for integral types. More...

#include <number.hpp>

List of all members.

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::Alignmentalignment_
IntegralBasebase_
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) ecl_assert_throw_decl(StandardException)

Detailed Description

template<typename Number>
class ecl::interfaces::FormatNumber< Number >

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.


Constructor & Destructor Documentation

template<typename Number>
ecl::interfaces::FormatNumber< Number >::FormatNumber ( int  w = -1,
ecl::Alignment  a = NoAlign,
ecl::IntegralBase  b = Dec 
) [inline]

Default constructor. Initialises the format tags for width, alignment and base.

Parameters:
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.

template<typename Number>
virtual ecl::interfaces::FormatNumber< Number >::~FormatNumber ( ) [inline, virtual]

Definition at line 70 of file number.hpp.


Member Function Documentation

template<typename Number >
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.

Parameters:
a: the aligning property for the output text.
See also:
ecl::formatters::Alignment

Definition at line 203 of file number.hpp.

template<typename Number >
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::base ( ecl::IntegralBase  b)

Sets the base format. For integral types, this can be binary, hexadecimal or decimal.

Parameters:
b: the base representation used for the output.
See also:
IntegralBase

Definition at line 186 of file number.hpp.

template<typename Number >
template<typename OutputStream >
void ecl::interfaces::FormatNumber< Number >::formatBin ( OutputStream &  ostream) const [protected]

Definition at line 226 of file number.hpp.

template<typename Number >
template<typename OutputStream >
void ecl::interfaces::FormatNumber< Number >::formatDec ( OutputStream &  ostream) const [protected]

Definition at line 257 of file number.hpp.

template<typename Number >
template<typename OutputStream >
void ecl::interfaces::FormatNumber< Number >::formatHex ( OutputStream &  ostream) const [protected]

Definition at line 240 of file number.hpp.

template<typename Number >
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.

Parameters:
w: the total width of the text output.
a: the aligning property for the output text.
b: the base representation used for the output.
Returns:
FormatNumber& : this formatter readied for use by a stream.

Definition at line 213 of file number.hpp.

template<typename Number>
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::operator() ( Number  n)

Convenient stream formatter. This function directly formats the specified input value with the stored settings.

Parameters:
n: the input value to be formatted.
Returns:
FormatNumber& : this formatter readied for use by a stream.

Insert an input value to be formatted when passed to a stream.

Definition at line 313 of file number.hpp.

template<typename Number>
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.

Parameters:
n: the input value to be formatted.
w: the total width of the text output.
b: the base representation used for the output.
Returns:
FormatNumber& : this formatter readied for use by a stream.

Temporarily configure the formatter with a width, base combination along with a value to be formatted.

Definition at line 328 of file number.hpp.

template<typename Number>
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.

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.
Returns:
FormatNumber& : this formatter readied for use by a stream.

Temporarily configure the formatter with a complete parameter set along with a value to be formatted.

Definition at line 343 of file number.hpp.

template<typename Number >
template<typename OutputStream >
void ecl::interfaces::FormatNumber< Number >::pad ( int  n,
OutputStream &  ostream 
) const [protected]

Definition at line 299 of file number.hpp.

template<typename Number >
template<typename OutputStream >
void ecl::interfaces::FormatNumber< Number >::postPad ( int  n,
OutputStream &  ostream 
) const [protected]

Definition at line 284 of file number.hpp.

template<typename Number >
template<typename OutputStream >
void ecl::interfaces::FormatNumber< Number >::prePad ( int  n,
OutputStream &  ostream 
) const [protected]

Definition at line 269 of file number.hpp.

template<typename Number >
FormatNumber< Number > & ecl::interfaces::FormatNumber< Number >::width ( int  w)

Sets the width format parameter. Setting this to -1 will turn off width formatting constraints.

Parameters:
w: the total width of the text output.

Definition at line 193 of file number.hpp.


Friends And Related Function Documentation

template<typename Number>
template<typename OutputStream , typename N >
OutputStream& operator<< ( OutputStream &  ostream,
FormatNumber< 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.

Parameters:
ostream: the stream.
formatter: the formatter with prespecified format parameters and input value.
Returns:
OutputStream& : return the stream that was utilised.
Exceptions:
StandardException: throws if the formatter is used multiply in one stream operation [debug mode only].

Definition at line 361 of file number.hpp.


Member Data Documentation

template<typename Number>
ecl::Alignment* ecl::interfaces::FormatNumber< Number >::alignment_ [protected]

Definition at line 162 of file number.hpp.

template<typename Number>
IntegralBase* ecl::interfaces::FormatNumber< Number >::base_ [protected]

Definition at line 162 of file number.hpp.

template<typename Number>
ecl::Alignment ecl::interfaces::FormatNumber< Number >::prm_alignment [protected]

Definition at line 159 of file number.hpp.

template<typename Number>
ecl::IntegralBase ecl::interfaces::FormatNumber< Number >::prm_base [protected]

Definition at line 160 of file number.hpp.

template<typename Number>
int ecl::interfaces::FormatNumber< Number >::prm_width [protected]

Definition at line 158 of file number.hpp.

template<typename Number>
bool ecl::interfaces::FormatNumber< Number >::ready_to_format [protected]

Definition at line 163 of file number.hpp.

template<typename Number>
ecl::Alignment ecl::interfaces::FormatNumber< Number >::tmp_alignment [protected]

Definition at line 159 of file number.hpp.

template<typename Number>
ecl::IntegralBase ecl::interfaces::FormatNumber< Number >::tmp_base [protected]

Definition at line 160 of file number.hpp.

template<typename Number>
int ecl::interfaces::FormatNumber< Number >::tmp_width [protected]

Definition at line 158 of file number.hpp.

template<typename Number>
Number ecl::interfaces::FormatNumber< Number >::value_ [protected]

Definition at line 164 of file number.hpp.

template<typename Number>
int* ecl::interfaces::FormatNumber< Number >::width_ [protected]

Definition at line 161 of file number.hpp.


The documentation for this class was generated from the following file:


ecl_formatters
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:36