#include <evo/impl/str.h>
Holds field and alignment formatting attributes.
- This is useful for formatting rows of text aligned by columns
- Fields that are smaller than the field width will be filled with padding up to the width
- Only numeric values (int, float, etc) and strings count as fields
- Used with operator<<() on String::Format or Stream::Format
- Note: Only numeric valus (int, float, etc) and strings count as fields, this doesn't apply to others
- Example
int main() {
<<
"Col A" <<
"Col B" <<
NL;
<<
"Col A" <<
"Col B" <<
NL;
return 0;
}
Output:
|
static void | setup_align (int &align_padleft, int &align_padright, int align_padding, const FmtSetField *field) |
| Used to setup and calculate alignment padding (used internally). More...
|
|
◆ FmtSetField() [1/2]
Main constructor.
- Parameters
-
align | Alignment type to use: fLEFT, fRIGHT, or fCENTER (faCURRENT for unspecified/default) |
width | Field character width, (-1 for unspecified/default) |
fill | Field fill character to pad up to width (0 for unspecified/default) |
◆ FmtSetField() [2/2]
Short constructor with default alignment.
- Parameters
-
width | Field character width, (-1 for unspecified/default) |
fill | Field fill character to pad up to width (0 for unspecified/default) |
◆ merge()
Merge source attributes (used internally).
- This copies attributes from src that aren't "unspecified"
- Parameters
-
◆ reset()
Reset attributes to defaults (not unspecified).
◆ setup_align()
static void setup_align |
( |
int & |
align_padleft, |
|
|
int & |
align_padright, |
|
|
int |
align_padding, |
|
|
const FmtSetField * |
field |
|
) |
| |
|
inlinestatic |
Used to setup and calculate alignment padding (used internally).
- Parameters
-
align_padleft | Set to left-padding size [out] |
align_padright | Set to right-padding size [out] |
align_padding | Padding width to use |
field | Field attribuets to use for alignment type (field->align), NULL for no alignment |
◆ align
Field alignment type (default: fLEFT)
◆ fill
Field fill character to pad up to width (default: ' ')
◆ width
Field width to align in (default: 0)
The documentation for this struct was generated from the following file: