ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | Public Methods | List of all members
TFormat< TChar >::Field Struct Reference

#include <format.hpp>

Collaboration diagram for TFormat< TChar >::Field:
[legend]

Class Description

template<typename TChar>
struct aworx::lib::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 to left-, right- or center-align 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 166 of file format.hpp.

Public Fields

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 Methods

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

Constructor & Destructor Documentation

◆ Field()

Field ( Box  content,
integer  pWidth,
Alignment  pAlignment = 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 196 of file format.hpp.

Member Data Documentation

◆ theContent

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 170 of file format.hpp.


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