dimval 0.2.0
Modern C++23 header-only library of dimensional values (units, measures, ranges)
Loading...
Searching...
No Matches
core.hpp File Reference

Common concepts, error types, and small utilities used across dimval. More...

#include <cstddef>
#include <cstdint>
#include <string>
#include <string_view>
#include <type_traits>
Include dependency graph for core.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dimval::ParseError
 Detailed error report from a parse_*_value call. More...
 
struct  dimval::RangeError
 Detailed error report from a UnitRangeValue::make / MeasureRangeValue::make call. More...
 
struct  dimval::RangeInclusion
 Inclusivity of both range bounds together. More...
 

Concepts

concept  dimval::NumericValue
 Concept for value types stored inside a UnitValue / MeasureValue.
 

Enumerations

enum class  dimval::ParseErrorCode {
  Empty , InvalidNumber , UnknownUnit , UnitMismatch ,
  MeasureMismatch , TrailingGarbage
}
 Error codes returned by parse_unit_value / parse_measure_value. More...
 
enum class  dimval::RangeErrorCode { MaxLessThanMin , EmptyOpenRange }
 Error codes for range construction. More...
 
enum class  dimval::Bound : std::uint8_t
 Inclusivity of a single range bound.
 
enum class  dimval::RangeCompareResult : std::int8_t
 Result of comparing two values or ranges.
 

Functions

constexpr std::string_view dimval::detail::ltrim (std::string_view s) noexcept
 Return a span between the first matching token and the trailing decimal/sign characters.
 

Detailed Description

Common concepts, error types, and small utilities used across dimval.

Enumeration Type Documentation

◆ ParseErrorCode

enum class dimval::ParseErrorCode
strong

Error codes returned by parse_unit_value / parse_measure_value.

Enumerator
Empty 

Input was empty or whitespace-only.

InvalidNumber 

Numeric portion failed to parse.

UnknownUnit 

Symbol/id not present in the registry.

UnitMismatch 

Symbol parsed but doesn't match the requested unit tag.

MeasureMismatch 

Measure id doesn't match the requested measure tag.

TrailingGarbage 

Unexpected characters after the value.

◆ RangeErrorCode

enum class dimval::RangeErrorCode
strong

Error codes for range construction.

Enumerator
MaxLessThanMin 

Upper bound is strictly less than lower bound.

EmptyOpenRange 

Equal bounds with at least one exclusive side.