Path of a value from the root value (validation violations): segments are field names or map keys and collection items indexes. Formats format it their way (JSON Pointer with pointer , XPath for XML, ...).
More...
#include <constraints.hpp>
|
| using | Segment = std::variant<std::string, std::size_t> |
Path of a value from the root value (validation violations): segments are field names or map keys and collection items indexes. Formats format it their way (JSON Pointer with pointer , XPath for XML, ...).
- Author
- Vincent Lachenal
- Since
- 0.3
◆ Segment
Path segment: field name or map key, or collection item index
◆ Path() [1/2]
| anch::val::Path::Path |
( |
| ) |
|
|
default |
◆ Path() [2/2]
| anch::val::Path::Path |
( |
std::vector< Segment > | segments | ) |
|
|
explicit |
Path constructor
- Parameters
-
| segments | the segments, from the root value |
◆ empty()
| bool anch::val::Path::empty |
( |
| ) |
const |
|
noexcept |
Check if path is the root value one
- Returns
true for the root value
◆ operator==()
| bool anch::val::Path::operator== |
( |
const Path & | other | ) |
const |
|
default |
Compare paths
- Parameters
-
- Returns
true when segments are equal
◆ pointer()
| std::string anch::val::Path::pointer |
( |
| ) |
const |
Format path as a JSON Pointer (RFC 6901): /pets/1/name , empty for the root value ( ~ and / are escaped)
- Returns
- the JSON Pointer
◆ segments()
| const std::vector< Segment > & anch::val::Path::segments |
( |
| ) |
const |
|
noexcept |
Segments getter
- Returns
- the segments, from the root value
The documentation for this class was generated from the following file: