11#include <commons/color.hpp>
12#include <commons/icon.hpp>
29template <
typename Self>
33 static constexpr double offset = 0.0;
34 static constexpr std::string_view formatter =
"default";
35 static constexpr int default_precision = -1;
36 static constexpr bool no_space_before_symbol =
false;
37 static constexpr std::optional<comms::Icon> icon = std::nullopt;
38 static constexpr std::optional<comms::Color> color = std::nullopt;
40 [[nodiscard]]
static constexpr UnitDescriptor descriptor()
noexcept {
43 .symbol = Self::symbol,
44 .short_name = Self::short_name,
45 .long_name = Self::long_name,
47 .factor = Self::factor,
48 .offset = Self::offset,
49 .formatter = Self::formatter,
50 .default_precision = Self::default_precision,
51 .no_space_before_symbol = Self::no_space_before_symbol,
62template <
typename Self,
typename BaseUnit>
65 using base_unit_t = BaseUnit;
70 static constexpr std::string_view formatter = {};
71 static constexpr int default_precision = -1;
72 static constexpr std::optional<comms::Icon> icon = std::nullopt;
73 static constexpr std::optional<comms::Color> color = std::nullopt;
78 .base_unit_id = BaseUnit::id,
80 .formatter = Self::formatter,
81 .default_precision = Self::default_precision,
Runtime metadata structs for units and measures.
CRTP base for measure tags.
Definition base.hpp:63
static constexpr std::string_view base_unit_id
Derived from the unit type — the redundant call-site string is gone.
Definition base.hpp:68
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
Marker base — concept detection picks up any type that derives from this.
Definition base.hpp:23
CRTP base for unit tags.
Definition base.hpp:30
Runtime metadata for a unit.
Definition descriptor.hpp:29
std::string_view id
Stable identifier (e.g. "m"). Unique per registry.
Definition descriptor.hpp:30
Marker base — concept detection picks up any type that derives from this.
Definition base.hpp:20