Go to the source code of this file.
|
template<arithmetic_c T, unit_enum_c unit_t> |
constexpr unit< T, unit_t > | qx::normalize_unit (unit< T, unit_t > unit) noexcept |
| The function returns the closest value greater than one from the SI for the unit of measurement. More...
|
|
template<arithmetic_c T, unit_enum_c unit_t> |
constexpr unit< T, unit_t > | qx::normalize_unit (T value, unit_t eInitialType) noexcept |
| The function returns the closest value greater than one from the SI for the unit of measurement. More...
|
|
template<arithmetic_c T, unit_enum_c unit_t, class char_t > |
std::optional< unit< T, unit_t > > | qx::unit_from_string (basic_string_view< char_t > svValue) noexcept |
| Creates a unit from a string. More...
|
|
template<arithmetic_c T, unit_enum_c unit_t, class char_t > |
std::optional< unit< T, unit_t > > | qx::unit_from_string (const char_t *pszValue) noexcept |
| Creates a unit from a string. More...
|
|
template<unit_enum_c unit_t, class char_t = char_type> |
constexpr std::optional< basic_string_view< char_t > > | qx::get_unit_suffix (unit_t eUnit) noexcept |
| Get a unit suffix if exists. More...
|
|
- Author
- Khrapov
- Date
- 11.08.2025
- Copyright
- © Nick Khrapov, 2025. All right reserved.
Definition in file base.h.
◆ get_unit_suffix()
template<unit_enum_c unit_t, class char_t = char_type>
constexpr std::optional<basic_string_view<char_t> > qx::get_unit_suffix |
( |
unit_t |
eUnit | ) |
|
|
constexprnoexcept |
Get a unit suffix if exists.
- Template Parameters
-
unit_t | - unit enum |
char_t | - result string view char type |
- Parameters
-
- Return values
-
◆ normalize_unit() [1/2]
template<arithmetic_c T, unit_enum_c unit_t>
constexpr unit<T, unit_t> qx::normalize_unit |
( |
T |
value, |
|
|
unit_t |
eInitialType |
|
) |
| |
|
constexprnoexcept |
The function returns the closest value greater than one from the SI for the unit of measurement.
- Template Parameters
-
T | - floating point or integral value type |
unit_t | - unit type enum |
- Parameters
-
value | - input unit value |
eInitialType | - input unit type |
- Return values
-
- | the closest value greater than one from the SI for the unit of measurement |
◆ normalize_unit() [2/2]
template<arithmetic_c T, unit_enum_c unit_t>
constexpr unit<T, unit_t> qx::normalize_unit |
( |
unit< T, unit_t > |
unit | ) |
|
|
constexprnoexcept |
The function returns the closest value greater than one from the SI for the unit of measurement.
- Template Parameters
-
T | - floating point or integral value type |
unit_t | - unit type enum |
- Parameters
-
- Return values
-
- | the closest value greater than one from the SI for the unit of measurement |
◆ unit_from_string() [1/2]
template<arithmetic_c T, unit_enum_c unit_t, class char_t >
std::optional<unit<T, unit_t> > qx::unit_from_string |
( |
basic_string_view< char_t > |
svValue | ) |
|
|
noexcept |
Creates a unit from a string.
Input examples: 20KiB
20 KiB
20 KiB
20KiB
- Template Parameters
-
T | - expected value type |
unit_t | - unit enum |
char_t | - input string char type |
- Parameters
-
svValue | - input string value |
- Return values
-
- | a unit if created successfully or std::nullopt |
◆ unit_from_string() [2/2]
template<arithmetic_c T, unit_enum_c unit_t, class char_t >
std::optional<unit<T, unit_t> > qx::unit_from_string |
( |
const char_t * |
pszValue | ) |
|
|
noexcept |
Creates a unit from a string.
Input examples: 20KiB
20 KiB
20 KiB
20KiB
- Template Parameters
-
T | - expected value type |
unit_t | - unit enum |
char_t | - input string char type |
- Parameters
-
pszValue | - input string value |
- Return values
-
- | a unit if created successfully or std::nullopt |