Maximum number of digits constraint (XSD totalDigits facet).
More...
#include <constraints.hpp>
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 |
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 ).
| bool anch::val::TotalDigits::check | ( | const V & | decimal, |
| std::string & | message ) const |
Check value
| V | the value type (number or decimal string) |
| decimal | the value |
| message | the error message (set when value is invalid) |
true when value is valid | std::size_t anch::val::TotalDigits::value |
Maximum number of digits