6#include <commons/color.hpp>
7#include <commons/icon.hpp>
20using color_field_t = std::optional<comms::Color>;
44 std::optional<comms::Icon>
icon{};
46 std::optional<comms::Color>
color{};
49 [[nodiscard]]
friend constexpr bool operator==(
const UnitDescriptor&,
61 std::optional<comms::Icon>
64 std::optional<comms::Color>
std::optional< comms::Icon > icon_field_t
Field types for the optional UI metadata.
Definition descriptor.hpp:19
Runtime metadata for a measure (a semantic specialization of a unit).
Definition descriptor.hpp:54
std::string_view id
Stable identifier (e.g. "distance"). Unique per registry.
Definition descriptor.hpp:55
std::string_view formatter
NOLINT(readability-redundant-member-init) Empty falls back to the base unit's formatter.
Definition descriptor.hpp:58
std::string_view name
Human-readable name (e.g. "Distance").
Definition descriptor.hpp:57
std::optional< comms::Color > color
NOLINT(readability-redundant-member-init) Optional UI accent; nullopt falls back to the unit's color.
Definition descriptor.hpp:65
std::string_view base_unit_id
Id of the unit this measure is defined in (e.g. "m").
Definition descriptor.hpp:56
std::optional< comms::Icon > icon
NOLINT(readability-redundant-member-init) Optional UI icon; nullopt falls back to the unit's icon.
Definition descriptor.hpp:62
int default_precision
Empty falls back to the base unit's precision.
Definition descriptor.hpp:60
Runtime metadata for a unit.
Definition descriptor.hpp:29
std::optional< comms::Icon > icon
NOLINT(readability-redundant-member-init) Optional UI icon (Iconify set:name); nullopt = unset.
Definition descriptor.hpp:44
double offset
Additive offset for affine conversions (e.g. Celsius/Kelvin).
Definition descriptor.hpp:37
std::string_view formatter
Formatter id; consumed by std::formatter.
Definition descriptor.hpp:38
std::string_view short_name
Short human-readable name (e.g. "m").
Definition descriptor.hpp:32
int default_precision
Default numeric precision; -1 = unset.
Definition descriptor.hpp:39
std::string_view symbol
Display symbol (e.g. "m"). Often equal to id.
Definition descriptor.hpp:31
std::string_view kind
Compatibility group (e.g. "length"). Two units convert if kinds match.
Definition descriptor.hpp:35
std::optional< comms::Color > color
NOLINT(readability-redundant-member-init) Optional UI accent (RGBA); nullopt = unset.
Definition descriptor.hpp:46
double factor
Linear conversion: canonical = factor * v + offset.
Definition descriptor.hpp:36
bool no_space_before_symbol
Render flush, e.g. "100%" instead of "100 %".
Definition descriptor.hpp:40
std::string_view long_name
Full human-readable name (e.g. "meter").
Definition descriptor.hpp:33
std::string_view id
Stable identifier (e.g. "m"). Unique per registry.
Definition descriptor.hpp:30