AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::val::CheckContext< X > Struct Template Reference

Context in which constraints are checked. More...

Inheritance diagram for anch::val::CheckContext< X >:
Collaboration diagram for anch::val::CheckContext< X >:

Detailed Description

template<typename X>
struct anch::val::CheckContext< X >

Context in which constraints are checked.

Formats specialize it for their contexts (anch-json: reader and writer contexts) ; anch-val specializes it for anch::val::ValidationContext . A specialization defines:

  • static bool enabled(const X& context) : constraints have to be checked (format options) ;
  • static void violation(X& context, const std::string& message) : report a violation on the current value (a format raises its error, a validation collects violations and goes on) ;
  • template<typename F> static void item(X& context, std::string_view key, F&& check) and template<typename F> static void item(X& context, std::size_t index, F&& check) : check a map value or a collection item (anch::val::Items ), the key or the index is part of the violation path.
Template Parameters
Xthe context type
Since
0.3

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