|
commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
|
An Iconify icon identifier — a set:name pair such as mdi:abacus.
More...
#include <icon.hpp>
Static Public Member Functions | |
| static constexpr Icon | from (const std::string_view value) |
Build from a whole set:name value, e.g. | |
| static constexpr Icon | from (const std::string_view set, const std::string_view name) |
Build by joining set and name with a :. | |
| static constexpr std::optional< Icon > | parse (const std::string_view value) |
Non-throwing validation: returns the Icon for a well-formed value (exactly one :, non-empty set and name, total length <= capacity) or std::nullopt. | |
Static Public Attributes | |
| static constexpr usize | capacity = 64 |
| Inline buffer capacity. | |
An Iconify icon identifier — a set:name pair such as mdi:abacus.
The full set:name string is stored inline in buf_; len_ is its length. Bytes past len_ stay zero (the buffer is value-initialized and the factories only ever write len_ bytes), which keeps the defaulted == well-behaved.
|
inlinestaticconstexpr |
Build by joining set and name with a :.
Same validation and failure modes as the single-argument from.
|
inlinestaticconstexpr |
Build from a whole set:name value, e.g.
"mdi:abacus". Throws on malformed input (std::invalid_argument) or one too long to fit (std::length_error); in a constant-evaluated context either becomes a compile error.
|
staticconstexpr |
Inline buffer capacity.
The longest MDI set:name is 46 chars; 64 leaves headroom for other sets and custom identifiers.