Skip to main content

FormatSpec Struct

Thin wrapper around FormatTag with implicit string conversions. More...

Declaration​

struct simaai::neat::FormatSpec { ... }

Included Headers​

#include <FormatSpec.h>

Public Constructors Index​

constexprFormatSpec ()=default

Default-construct as unset (Auto). More...

constexprFormatSpec (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...

booloperator== (const FormatSpec &other) const

Equality compares the underlying tag. More...

booloperator!= (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​

boolempty () const

True iff the tag is Auto (unset). More...

std::stringstr () const

Canonical string form of the tag. More...

Public Member Attributes Index​

FormatTagtag = 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

FormatTag

Definition at line 285 of file FormatSpec.h.

Public Constructors​

FormatSpec()​

constexpr simaai::neat::FormatSpec::FormatSpec ()
constexpr default

Default-construct as unset (Auto).

Definition at line 289 of file FormatSpec.h.

FormatSpec()​

constexpr simaai::neat::FormatSpec::FormatSpec (FormatTag value)
inline constexpr

Construct from a FormatTag value.

Definition at line 291 of file FormatSpec.h.

FormatSpec()​

simaai::neat::FormatSpec::FormatSpec (const std::string & value)
inline

Parse from a string token (case-insensitive); unknown tokens become Auto.

Definition at line 293 of file FormatSpec.h.

FormatSpec()​

simaai::neat::FormatSpec::FormatSpec (const char * value)
inline

Parse from a C string token; null pointer treated as empty.

Definition at line 295 of file FormatSpec.h.

Public Operators​

operator bool()​

simaai::neat::FormatSpec::operator bool ()
inline explicit

True iff the tag is set (anything other than Auto).

Definition at line 331 of file FormatSpec.h.

operator std::string()​

simaai::neat::FormatSpec::operator std::string ()
inline

Implicit conversion to canonical string token.

Definition at line 335 of file FormatSpec.h.

operator!=()​

bool simaai::neat::FormatSpec::operator!= (const FormatSpec & other)
inline

Inequality compares the underlying tag.

Definition at line 323 of file FormatSpec.h.

operator=()​

FormatSpec & simaai::neat::FormatSpec::operator= (FormatTag value)
inline

Assign from a FormatTag.

Definition at line 299 of file FormatSpec.h.

operator=()​

FormatSpec & simaai::neat::FormatSpec::operator= (const std::string & value)
inline

Assign from a parsed string token.

Definition at line 304 of file FormatSpec.h.

operator=()​

FormatSpec & simaai::neat::FormatSpec::operator= (const char * value)
inline

Assign from a parsed C string token.

Definition at line 309 of file FormatSpec.h.

operator==()​

bool simaai::neat::FormatSpec::operator== (const FormatSpec & other)
inline

Equality compares the underlying tag.

Definition at line 319 of file FormatSpec.h.

Public Member Functions​

empty()​

bool simaai::neat::FormatSpec::empty ()
inline

True iff the tag is Auto (unset).

Definition at line 315 of file FormatSpec.h.

str()​

std::string simaai::neat::FormatSpec::str ()
inline

Canonical string form of the tag.

Definition at line 327 of file FormatSpec.h.

Public Member Attributes​

tag​

FormatTag simaai::neat::FormatSpec::tag = FormatTag::Auto

Underlying tag (defaults to unset).

Definition at line 286 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.