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

String pattern constraint ( pattern ). More...

#include <constraints.hpp>

Collaboration diagram for anch::val::Pattern:

Public Member Functions

template<anch::val::StringLike V>
bool check (const V &str, std::string &message) const

Public Attributes

std::shared_ptr< const anch::val::PatternMatcher > matcher
std::string source
anch::val::PatternSyntax syntax = anch::val::PatternSyntax::ECMASCRIPT

Detailed Description

String pattern constraint ( pattern ).

With ECMAScript syntax ( anch::val::pattern ), the pattern is searched in the value (it is not anchored: use ^ and $ to match the whole value), as in JSON Schema. With XSD syntax ( anch::val::xsdPattern ), it matches the whole value.

Author
Vincent Lachenal
Since
0.2

Member Function Documentation

◆ check()

template<anch::val::StringLike V>
bool anch::val::Pattern::check ( const V & str,
std::string & message ) const

Check value

Template Parameters
Vthe value type
Parameters
strthe value
messagethe error message (set when value is invalid)
Returns
true when value is valid

Member Data Documentation

◆ matcher

std::shared_ptr<const anch::val::PatternMatcher> anch::val::Pattern::matcher

Pattern matcher

◆ source

std::string anch::val::Pattern::source

◆ syntax


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