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

Validation context. More...

#include <constraints.hpp>

Collaboration diagram for anch::val::ValidationContext:

Public Member Functions

void enter (std::string_view field)
void enter (std::size_t index)
void leave ()
void add (const std::string &message)
std::vector< anch::val::Violation > & violations ()

Detailed Description

Validation context.

Context used by validations ( anch::val::validate ) : it keeps the path of the checked value and collects violations.

Author
Vincent Lachenal
Since
0.2

Member Function Documentation

◆ add()

void anch::val::ValidationContext::add ( const std::string & message)

Add violation on the current value

Parameters
messagethe violation message

◆ enter() [1/2]

void anch::val::ValidationContext::enter ( std::size_t index)

Enter array item

Parameters
indexthe item index

◆ enter() [2/2]

void anch::val::ValidationContext::enter ( std::string_view field)

Enter object field or map entry

Parameters
fieldthe field name or map key

◆ leave()

void anch::val::ValidationContext::leave ( )

Leave the current field or item

◆ violations()

std::vector< anch::val::Violation > & anch::val::ValidationContext::violations ( )

Collected violations getter

Returns
the violations

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