AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::val::TotalDigits Struct Reference

Maximum number of digits constraint (XSD totalDigits facet). More...

#include <constraints.hpp>

Collaboration diagram for anch::val::TotalDigits:

Public Member Functions

template<typename V>
requires (anch::val::Number<V> || anch::val::StringLike<V>)
bool check (const V &decimal, std::string &message) const

Public Attributes

std::size_t value

Detailed Description

Maximum number of digits constraint (XSD totalDigits facet).

Digits are counted on the decimal value: leading zeros of the integer part and trailing zeros of the fraction part are not counted. Floating point numbers are counted on their shortest decimal representation ( std::to_chars ). Strings have to be decimals ( [+-]?[0-9]*(.[0-9]*)? with at least one digit, as xs:decimal ).

Author
Vincent Lachenal
Since
0.3

Member Function Documentation

◆ check()

template<typename V>
requires (anch::val::Number<V> || anch::val::StringLike<V>)
bool anch::val::TotalDigits::check ( const V & decimal,
std::string & message ) const

Check value

Template Parameters
Vthe value type (number or decimal string)
Parameters
decimalthe value
messagethe error message (set when value is invalid)
Returns
true when value is valid

Member Data Documentation

◆ value

std::size_t anch::val::TotalDigits::value

Maximum number of digits


The documentation for this struct was generated from the following file: