ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
TFormat< TChar >::Field Struct Reference

Description:

template<typename TChar>
struct alib::strings::TFormat< TChar >::Field

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, module ALib Boxing is not available, the field content parameter will be of type const String&.
Otherwise, box-function FAppend will be invoked on the given box internally to receive the string representation.
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.

Definition at line 162 of file format.inl.

Collaboration diagram for TFormat< TChar >::Field:
[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:

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

Field Details:

◆ alignment

template<typename TChar >
lang::Alignment alignment

The alignment of the contents within the field.

Definition at line 173 of file format.inl.

◆ fieldWidth

template<typename TChar >
integer fieldWidth

The width of the field.

Definition at line 172 of file format.inl.

◆ padChar

template<typename TChar >
TChar padChar

The characters used for padding the contents within the field.

Definition at line 174 of file format.inl.

◆ theContent

template<typename TChar >
Box theContent

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

Definition at line 166 of file format.inl.

Constructor(s) / Destructor Details:

◆ Field()

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

Constructor. Copies the parameters.

Parameters
contentThe contents of the field. If 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 190 of file format.inl.


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