|
LibSWOC++ 1.5.14
Solid Wall of C++
|
#include <bwf_base.h>

Classes | |
| struct | Property |
| Handrolled initialization the character syntactic property data. More... | |
Public Types | |
| enum class | Align : char { NONE , LEFT , RIGHT , CENTER , SIGN } |
| Flag for how to align the output inside a limited width field. More... | |
| using | self_type = Spec |
| Self reference type. | |
Public Member Functions | |
| constexpr | Spec () |
| Constructor a default instance. | |
| Spec (const TextView &fmt) | |
| Construct by parsing fmt. | |
| bool | parse (TextView fmt) |
| Parse a format specification. | |
| bool | has_numeric_type () const |
| Check if the type in this is numeric. | |
| bool | has_upper_case_type () const |
| Check if the type in this is an upper case variant. | |
| bool | has_pointer_type () const |
| Check if the type is a raw pointer. | |
| bool | has_valid_type () const |
| Check if the type is valid. | |
Static Public Member Functions | |
| static bool | is_type (char c) |
| Validate c is a specifier type indicator. | |
| static bool | is_numeric_type (char c) |
| Check if the type flag is numeric. | |
| static bool | is_upper_case_type (char c) |
| Check if the type is an upper case variant. | |
Public Attributes | |
| char | _fill = ' ' |
| Fill character. | |
| char | _sign = SIGN_NEG |
| enum swoc::bwf::Spec::Align | _align = Align::NONE |
| Output field alignment. | |
| char | _type = DEFAULT_TYPE |
| Type / radix indicator. | |
| bool | _radix_lead_p = false |
| Print leading radix indication. | |
| unsigned int | _min = 0 |
| Minimum width. | |
| int | _prec = -1 |
| Precision. | |
| unsigned int | _max = std::numeric_limits<unsigned int>::max() |
| Maximum width. | |
| int | _idx = -1 |
| Positional "name" of the specification. | |
| std::string_view | _name |
| Name of the specification. | |
| std::string_view | _ext |
| Extension if provided. | |
Static Public Attributes | |
| static constexpr char | DEFAULT_TYPE = 'g' |
| Default format type. | |
| static constexpr char | INVALID_TYPE = 0 |
| Type for missing or invalid specifier. | |
| static constexpr char | LITERAL_TYPE = '"' |
| Internal type to mark a literal. | |
| static constexpr char | CAPTURE_TYPE = 1 |
| Internal type to mark a capture. | |
| static constexpr char | SIGN_ALWAYS = '+' |
| Always print a sign character. | |
| static constexpr char | SIGN_NEVER = ' ' |
| Never print a sign character. | |
| static constexpr char | SIGN_NEG = '-' |
| Print a sign character only for negative values (default). | |
| static const self_type | DEFAULT |
| Global default instance for use in situations where a format specifier isn't available. | |
Protected Member Functions | |
| Align | align_of (char c) |
| Validate character is alignment character and return the appropriate enum value. | |
| bool | is_sign (char c) |
| Validate is sign indicator. | |
Static Protected Member Functions | |
| static const Property & | Get_Prop () |
| Character property map. | |
Parsed version of a format specifier.
Literals are represented as an instance of this class, with the type set to LITERAL_TYPE and the literal text in the _ext field.
Definition at line 37 of file bwf_base.h.
| using swoc::bwf::Spec::self_type = Spec |
Self reference type.
Definition at line 38 of file bwf_base.h.
|
strong |
Flag for how to align the output inside a limited width field.
| Enumerator | |
|---|---|
| NONE | No alignment. |
| LEFT | Left alignment '<'. |
| RIGHT | Right alignment '>'. |
| CENTER | Center alignment '^'. |
| SIGN | Align plus/minus sign before numeric fill. '='. |
Definition at line 62 of file bwf_base.h.
|
inlineconstexpr |
Constructor a default instance.
Definition at line 50 of file bwf_base.h.
| swoc::bwf::Spec::Spec | ( | const TextView & | fmt | ) |
Construct by parsing fmt.
Definition at line 66 of file bw_format.cc.
|
inlineprotected |
Validate character is alignment character and return the appropriate enum value.
— Spec —
Definition at line 482 of file bwf_base.h.
|
inlinestaticprotected |
Character property map.
Definition at line 123 of file bwf_base.h.
|
inline |
Check if the type in this is numeric.
Definition at line 507 of file bwf_base.h.
|
inline |
Check if the type is a raw pointer.
Definition at line 517 of file bwf_base.h.
|
inline |
Check if the type in this is an upper case variant.
Definition at line 512 of file bwf_base.h.
|
inline |
Check if the type is valid.
Definition at line 522 of file bwf_base.h.
|
inlinestatic |
Check if the type flag is numeric.
Definition at line 502 of file bwf_base.h.
|
inlineprotected |
Validate is sign indicator.
Definition at line 487 of file bwf_base.h.
|
inlinestatic |
Validate c is a specifier type indicator.
Definition at line 492 of file bwf_base.h.
|
inlinestatic |
Check if the type is an upper case variant.
Definition at line 497 of file bwf_base.h.
| bool swoc::bwf::Spec::parse | ( | TextView | fmt | ) |
Parse a format specification.
Parse a specifier. State is not reset, this should be default constructed before calling.
Definition at line 72 of file bw_format.cc.
| std::string_view swoc::bwf::Spec::_ext |
Extension if provided.
Definition at line 77 of file bwf_base.h.
| char swoc::bwf::Spec::_fill = ' ' |
Fill character.
Definition at line 59 of file bwf_base.h.
| int swoc::bwf::Spec::_idx = -1 |
Positional "name" of the specification.
Definition at line 75 of file bwf_base.h.
| unsigned int swoc::bwf::Spec::_max = std::numeric_limits<unsigned int>::max() |
Maximum width.
Definition at line 74 of file bwf_base.h.
| unsigned int swoc::bwf::Spec::_min = 0 |
Minimum width.
Definition at line 72 of file bwf_base.h.
| std::string_view swoc::bwf::Spec::_name |
Name of the specification.
Definition at line 76 of file bwf_base.h.
| int swoc::bwf::Spec::_prec = -1 |
Precision.
Definition at line 73 of file bwf_base.h.
| bool swoc::bwf::Spec::_radix_lead_p = false |
Print leading radix indication.
Definition at line 70 of file bwf_base.h.
| char swoc::bwf::Spec::_sign = SIGN_NEG |
Numeric sign style.
Definition at line 60 of file bwf_base.h.
| char swoc::bwf::Spec::_type = DEFAULT_TYPE |
Type / radix indicator.
Definition at line 69 of file bwf_base.h.
|
staticconstexpr |
Internal type to mark a capture.
Definition at line 43 of file bwf_base.h.
|
static |
Global default instance for use in situations where a format specifier isn't available.
Definition at line 80 of file bwf_base.h.
|
staticconstexpr |
Default format type.
Definition at line 40 of file bwf_base.h.
|
staticconstexpr |
Type for missing or invalid specifier.
Definition at line 41 of file bwf_base.h.
|
staticconstexpr |
Internal type to mark a literal.
Definition at line 42 of file bwf_base.h.
|
staticconstexpr |
Always print a sign character.
Definition at line 45 of file bwf_base.h.
|
staticconstexpr |
Print a sign character only for negative values (default).
Definition at line 47 of file bwf_base.h.
|
staticconstexpr |
Never print a sign character.
Definition at line 46 of file bwf_base.h.