|
dimval 0.2.0
Modern C++23 header-only library of dimensional values (units, measures, ranges)
|
Parse string literals like "42.5 m" into UnitValue / MeasureValue. More...
#include <dimval/core.hpp>#include <dimval/measure.hpp>#include <dimval/parse_detail.hpp>#include <dimval/registry.hpp>#include <dimval/traits.hpp>#include <dimval/unit.hpp>#include <expected>#include <string>#include <string_view>

Go to the source code of this file.
Classes | |
| struct | dimval::DynamicUnitValue |
| Type-erased dynamic parse result. More... | |
Functions | |
| template<UnitLike U, NumericValue T = double> | |
| std::expected< UnitValue< U, T >, ParseError > | dimval::parse_unit_value (std::string_view input) |
Parse a string of the form "42.5 m" into a UnitValue<U,T>. | |
| template<MeasureLike M, NumericValue T = double> | |
| std::expected< MeasureValue< M, T >, ParseError > | dimval::parse_measure_value (std::string_view input) |
Parse a string of the form "42.5 m" into a MeasureValue<M,T>. | |
| std::expected< DynamicUnitValue, ParseError > | dimval::parse_dynamic_unit_value (std::string_view input) |
Parse a string of the form "42.5 m" against the runtime registry. | |
Parse string literals like "42.5 m" into UnitValue / MeasureValue.
|
inline |
Parse a string of the form "42.5 m" against the runtime registry.
Returns a (descriptor*, value) pair. Useful when the target unit isn't known at compile time (e.g. parsing config files with arbitrary user units).
| std::expected< MeasureValue< M, T >, ParseError > dimval::parse_measure_value | ( | std::string_view | input | ) |
Parse a string of the form "42.5 m" into a MeasureValue<M,T>.
Thin forward to MeasureValue<M,T>::parse.
| std::expected< UnitValue< U, T >, ParseError > dimval::parse_unit_value | ( | std::string_view | input | ) |
Parse a string of the form "42.5 m" into a UnitValue<U,T>.
Thin forward to UnitValue<U,T>::parse so this free-function form stays available.