23 constexpr iso_639() noexcept : v0(0), v1(0), v2(0) {}
25 constexpr iso_639(std::string_view str)
noexcept
27 if (std::size(str) == 0) {
31 }
else if (std::size(str) == 2) {
32 _v0 = to_lower(str[0]);
33 _v1 = to_lower(str[1]);
35 }
else if (std::size(str) == 3) {
36 _v0 = to_lower(str[0]);
37 _v1 = to_lower(str[1]);
38 _v2 = to_lower(str[2]);
44 constexpr explicit operator bool ()
const noexcept
46 return _v0 == 0 and _v1 == 0 and _v2 == 0;
49 constexpr explicit operator std::string()
const noexcept
70 [[nodiscard]]
constexpr friend operator==(
iso_639 const &lhs,
iso_639 const &rhs)
noexcept =
default;
71 [[nodiscard]]
constexpr friend operator<=>(
iso_639 const &lhs,
iso_639 const &rhs)
noexcept =
default;
84 [[nodiscard]]
constexpr uint32_t to_int()
const noexcept
86 return static_cast<uint32_t
>(_v0) | (
static_cast<uint32_t
>(_v1) << 8) | (
static_cast<uint32_t
>(_v2) << 16);
89 constexpr void from_int(uint32_t v)
noexcept
91 tt_axiom((v >> 24) == 0);
92 _v0 =
static_cast<uint8_t
>(v);
93 _v1 =
static_cast<uint8_t
>(v >> 8);
94 _v2 =
static_cast<uint8_t
>(v >> 16);