FormatSpec Struct
Thin wrapper around FormatTag with implicit string conversions. More...
Declaration
Included Headers
Public Constructors Index
| constexpr | FormatSpec ()=default |
|
Default-construct as unset (Auto). More... | |
| constexpr | FormatSpec (FormatTag value) |
|
Construct from a FormatTag value. More... | |
| FormatSpec (const std::string &value) | |
|
Parse from a string token (case-insensitive); unknown tokens become Auto. More... | |
| FormatSpec (const char *value) | |
|
Parse from a C string token; null pointer treated as empty. More... | |
Public Operators Index
| FormatSpec & | operator= (FormatTag value) |
|
Assign from a FormatTag. More... | |
| FormatSpec & | operator= (const std::string &value) |
|
Assign from a parsed string token. More... | |
| FormatSpec & | operator= (const char *value) |
|
Assign from a parsed C string token. More... | |
| bool | operator== (const FormatSpec &other) const |
|
Equality compares the underlying tag. More... | |
| bool | operator!= (const FormatSpec &other) const |
|
Inequality compares the underlying tag. More... | |
| operator bool () const | |
|
True iff the tag is set (anything other than Auto). More... | |
| operator std::string () const | |
|
Implicit conversion to canonical string token. More... | |
Public Member Functions Index
| bool | empty () const |
|
True iff the tag is Auto (unset). More... | |
| std::string | str () const |
|
Canonical string form of the tag. More... | |
Public Member Attributes Index
| FormatTag | tag = FormatTag::Auto |
|
Underlying tag (defaults to unset). More... | |
Description
Thin wrapper around FormatTag with implicit string conversions.
Used in option structs and caps fields where a format may arrive as either a FormatTag enum value or a string token. Implicit conversions to/from std::string keep call sites compact; the empty() and operator bool() predicates both treat Auto as "unset".
- See Also
Definition at line 276 of file FormatSpec.h.
Public Constructors
FormatSpec()
| constexpr default |
Default-construct as unset (Auto).
Definition at line 280 of file FormatSpec.h.
FormatSpec()
| inline constexpr |
Construct from a FormatTag value.
Definition at line 282 of file FormatSpec.h.
FormatSpec()
| inline |
Parse from a string token (case-insensitive); unknown tokens become Auto.
Definition at line 284 of file FormatSpec.h.
FormatSpec()
| inline |
Parse from a C string token; null pointer treated as empty.
Definition at line 286 of file FormatSpec.h.
Public Operators
operator bool()
| inline explicit |
True iff the tag is set (anything other than Auto).
Definition at line 322 of file FormatSpec.h.
operator std::string()
| inline |
Implicit conversion to canonical string token.
Definition at line 326 of file FormatSpec.h.
operator!=()
| inline |
Inequality compares the underlying tag.
Definition at line 314 of file FormatSpec.h.
operator=()
| inline |
Assign from a FormatTag.
Definition at line 290 of file FormatSpec.h.
operator=()
| inline |
Assign from a parsed string token.
Definition at line 295 of file FormatSpec.h.
operator=()
| inline |
Assign from a parsed C string token.
Definition at line 300 of file FormatSpec.h.
operator==()
| inline |
Equality compares the underlying tag.
Definition at line 310 of file FormatSpec.h.
Public Member Functions
empty()
| inline |
True iff the tag is Auto (unset).
Definition at line 306 of file FormatSpec.h.
str()
| inline |
Canonical string form of the tag.
Definition at line 318 of file FormatSpec.h.
Public Member Attributes
tag
|
Underlying tag (defaults to unset).
Definition at line 277 of file FormatSpec.h.
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.