ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::strings::TField< TChar > Struct Template Reference

Description:

template<typename TChar>
struct alib::strings::TField< TChar >

Used to create temporary objects which are appended to AString instances.

Appends the given object to the AString using a defined 'field'-width. If the contents of the field is shorter than parameter width specifies, the field is filled with a corresponding amount of padChar characters.
Parameter alignment of type Alignment allows left-, right- or center-aligning. the contents of the field.

Note
In case, the module ALib Boxing is not available, the field content parameter will be of type const String& and this class is available after the inclusion of the header ALib.Strings.H.
Otherwise, a different implementation is used, which becomes available only with the inclusion of the header ALib.Boxing.H. That version stores a Box instead of a string type, and this way is able to place any type which disposes about an implementation of box-function FAppend.
Therefore, it is mandatory that for any type that is used with this class to be formatted in a field, this box-function has to be implemented. As documented with that interface, for types that are appendable to AString objects already, all that is needed is to use macro ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE with the type in the bootstrap section of an application.
Template Parameters
TCharThe character type of the AString that instances can be "applied" to.

Definition at line 50 of file strings_tfield.inl.

Collaboration diagram for alib::strings::TField< TChar >:
[legend]

Public Field Index:

lang::Alignment alignment
 The alignment of the contents within the field.
 
integer fieldWidth
 The width of the field.
 
TChar padChar
 The characters used for padding the contents within the field.
 
Box theContent
 

Public Method Index:

 TField (Box content, integer pWidth, lang::Alignment pAlignment=lang::Alignment::Right, TChar fillChar=' ')
 

Field Details:

◆ alignment

template<typename TChar>
lang::Alignment alib::strings::TField< TChar >::alignment

The alignment of the contents within the field.

Definition at line 57 of file strings_tfield.inl.

◆ fieldWidth

template<typename TChar>
integer alib::strings::TField< TChar >::fieldWidth

The width of the field.

Definition at line 56 of file strings_tfield.inl.

◆ padChar

template<typename TChar>
TChar alib::strings::TField< TChar >::padChar

The characters used for padding the contents within the field.

Definition at line 58 of file strings_tfield.inl.

◆ theContent

template<typename TChar>
Box alib::strings::TField< TChar >::theContent

The content of the field. If module ALib Boxing is not available, this field is of type const TString<TChar>&

Definition at line 53 of file strings_tfield.inl.

Constructor(s) / Destructor Details:

◆ TField()

template<typename TChar>
alib::strings::TField< TChar >::TField ( Box content,
integer pWidth,
lang::Alignment pAlignment = lang::Alignment::Right,
TChar fillChar = ' ' )
inline

Constructor. Copies the parameters.

Parameters
contentThe contents of the field. If the module ALib Boxing is not available, this field is of type const TString<TChar>&, otherwise of type Box.
pWidthThe width of the field
pAlignmentThe alignment of the contents within the field. Defaults to Alignment::Right Other options are Alignment::Left and Alignment::Center.
fillCharThe character used to fill the field up to its size. Defaults to ' ' (space).

Definition at line 74 of file strings_tfield.inl.


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