Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
IntFormat Class Reference

#include <elm/io/Output.h>

Public Member Functions

 IntFormat ()
 
 IntFormat (t::int8 value)
 
 IntFormat (t::uint8 value)
 
 IntFormat (t::int16 value)
 
 IntFormat (t::uint16 value)
 
 IntFormat (t::int32 value)
 
 IntFormat (t::uint32 value)
 
 IntFormat (t::int64 value)
 
 IntFormat (t::uint64 value)
 
IntFormat operator() (t::int8 value)
 
IntFormat operator() (t::uint8 value)
 
IntFormat operator() (t::int16 value)
 
IntFormat operator() (t::uint16 value)
 
IntFormat operator() (t::int32 value)
 
IntFormat operator() (t::uint32 value)
 
IntFormat operator() (t::int64 value)
 
IntFormat operator() (t::uint64 value)
 
IntFormatbase (int b)
 
IntFormatbin (void)
 
IntFormatoct (void)
 
IntFormatdec (void)
 
IntFormathex (void)
 
IntFormatwidth (int w)
 
IntFormatalign (alignment_t a)
 
IntFormatleft (void)
 
IntFormatcenter (void)
 
IntFormatright (void)
 
IntFormatupper (void)
 
IntFormatlower (void)
 
IntFormatsign (void)
 
IntFormatpad (char p)
 

Public Attributes

t::int64 _val
 
unsigned char _base
 
unsigned char _width
 
unsigned _align: 5
 
unsigned _upper: 1
 
unsigned _sign: 1
 
unsigned _displaySign: 1
 
char _pad
 
char _size
 

Detailed Description

This class is used to perform formatting on integer passed to the Output class.

It is rarely used as-is but with some inlines functions performing formatting: io::base, io::bin, io::hex, op::width, io::align, io::left, io::center, io::right, io::pad, io::uppercase, io::lowercase.

Constructor & Destructor Documentation

◆ IntFormat() [1/9]

IntFormat ( )
inline

◆ IntFormat() [2/9]

IntFormat ( t::int8  value)
inline

◆ IntFormat() [3/9]

IntFormat ( t::uint8  value)
inline

◆ IntFormat() [4/9]

IntFormat ( t::int16  value)
inline

◆ IntFormat() [5/9]

IntFormat ( t::uint16  value)
inline

◆ IntFormat() [6/9]

IntFormat ( t::int32  value)
inline

◆ IntFormat() [7/9]

IntFormat ( t::uint32  value)
inline

◆ IntFormat() [8/9]

IntFormat ( t::int64  value)
inline

◆ IntFormat() [9/9]

IntFormat ( t::uint64  value)
inline

Member Function Documentation

◆ align()

IntFormat align ( alignment_t  a)
inline

Set the alignment of the format.

Parameters
aAlignment (one of io::LEFT, io::CENTER or io::RIGHT).
Returns
Built format.

References IntFormat::_align.

Referenced by elm::io::align().

◆ base()

IntFormat base ( int  b)
inline

Set the base.

Parameters
bBase of the format.
Returns
Built format.

References IntFormat::_base.

Referenced by elm::io::base().

◆ bin()

IntFormat bin ( void  )
inline

Set the base to binary.

Returns
Built format.

References IntFormat::_base, and IntFormat::_sign.

Referenced by elm::io::bin().

◆ center()

IntFormat center ( void  )
inline

Set the format to centered alignment.

Returns
Built format.

References IntFormat::_align, and elm::io::CENTER.

Referenced by elm::io::center().

◆ dec()

IntFormat dec ( void  )
inline

Set the base to decimal.

Returns
Built format.

References IntFormat::_base.

◆ hex()

IntFormat hex ( void  )
inline

Set the base to hexadecimal.

Returns
Built format.

References IntFormat::_base, and IntFormat::_sign.

Referenced by elm::io::byte(), elm::io::hex(), and elm::io::pointer().

◆ left()

IntFormat left ( void  )
inline

Set the format to left alignment.

Returns
Built format.

References IntFormat::_align, and elm::io::LEFT.

Referenced by elm::io::left().

◆ lower()

IntFormat lower ( void  )
inline

Use lower case letters for base greater than 10.

Returns
Built format.

References IntFormat::_upper.

Referenced by elm::io::lowercase().

◆ oct()

IntFormat oct ( void  )
inline

Set the base to octal.

Returns
Built format.

References IntFormat::_base, and IntFormat::_sign.

Referenced by elm::io::oct().

◆ operator()() [1/8]

IntFormat operator() ( t::int16  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [2/8]

IntFormat operator() ( t::int32  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [3/8]

IntFormat operator() ( t::int64  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [4/8]

IntFormat operator() ( t::int8  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [5/8]

IntFormat operator() ( t::uint16  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [6/8]

IntFormat operator() ( t::uint32  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [7/8]

IntFormat operator() ( t::uint64  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ operator()() [8/8]

IntFormat operator() ( t::uint8  value)
inline

Instantiate the format for the given integer.

Parameters
valueInteger to format.
Returns
New integer format.

References IntFormat::_val.

◆ pad()

IntFormat pad ( char  p)
inline

Set the padding character.

Parameters
pPadding characrer.
Returns
Built format.

References IntFormat::_pad, and elm::io::p().

Referenced by elm::io::byte(), elm::io::pad(), and elm::io::pointer().

◆ right()

IntFormat right ( void  )
inline

Set the format to right alignment.

Returns
Built format.

References IntFormat::_align, and elm::io::RIGHT.

Referenced by elm::io::byte(), and elm::io::right().

◆ sign()

IntFormat sign ( void  )
inline

Ever display the sign of the integer (even for positives).

Returns
Built format.

References IntFormat::_displaySign.

Referenced by elm::io::sign().

◆ upper()

IntFormat upper ( void  )
inline

Use upper case letters for base greater than 10.

Returns
Built format.

References IntFormat::_upper.

Referenced by elm::io::uppercase().

◆ width()

IntFormat width ( int  w)
inline

Set the width of the format.

Parameters
wWidth in characters.
Returns
Built format.

References IntFormat::_width.

Referenced by elm::io::byte(), elm::io::pointer(), and elm::io::width().

Member Data Documentation

◆ _align

unsigned _align

Alignment of integer in the field. One of LEFT, CENTER or RIGHT.

Referenced by IntFormat::align(), IntFormat::center(), IntFormat::left(), Output::print(), and IntFormat::right().

◆ _base

IntFormat _base

Numeric base used to display the integer (default to 10).

Referenced by IntFormat::base(), IntFormat::bin(), IntFormat::dec(), IntFormat::hex(), IntFormat::oct(), and Output::print().

◆ _displaySign

char _displaySign

If true, the sign of signed value is always displayed. Else only the minus is displayed when needed.

Referenced by Output::print(), and IntFormat::sign().

◆ _pad

char _pad

Character used to pad the displayed integer in the field (default '0').

Referenced by IntFormat::pad(), and Output::print().

◆ _sign

unsigned _sign

If true, ever display the sign. If false (default), only display negative sign.

Referenced by IntFormat::bin(), IntFormat::hex(), IntFormat::oct(), and Output::print().

◆ _size

char _size

Referenced by Output::print().

◆ _upper

unsigned _upper

If true, upper case characters will be used to display integer whose base is greater than 10. If false (default), lower case characters will be used.

Referenced by IntFormat::lower(), Output::print(), and IntFormat::upper().

◆ _val

◆ _width

unsigned char _width

Width of the field where the integer will be displayed. Default 0 for no field width constraint. If the displayed integer size is less than the width, it will be aligned according the IntFormat::align attribute and padded according the IntFormat::pad attribute.

Referenced by Output::print(), and IntFormat::width().


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