Contains constraints, built-in constraint tags, fields and models. More...
#include <algorithm>
#include <unordered_set>
#include <regex>
#include "layer.h"
#include "utility.h"
#include "containers.h"
Go to the source code of this file.
Data Structures | |
struct | garlic::ConstraintResult |
Result of a constriant test. More... | |
class | garlic::Constraint |
Smallest unit of data validation. More... | |
struct | garlic::type_tag |
Constraint Tag that passes if the layer has matching data type. More... | |
struct | garlic::range_tag |
Constraint Tag that passes if the layer is within a certain boundary. More... | |
struct | garlic::regex_tag |
Constraint Tag that passes if a specified regex pattern passes the test. More... | |
struct | garlic::any_tag |
Constraint Tag that passes if any of the inner constraints pass. More... | |
struct | garlic::list_tag |
Constraint Tag that passes if the layer is a list and all its elements pass the inner constraints. More... | |
class | garlic::tuple_tag |
Constraint Tag that passes if the layer is a list and its first n elements pass the first n constraints. More... | |
class | garlic::map_tag |
Constraint Tag that passes if the layer's members pass key and value constraints. More... | |
struct | garlic::all_tag |
Constraint Tag that passes if all inner constraints pass the layer. More... | |
struct | garlic::literal_tag< T > |
Constraint Tag that passes if layer is equal to a specified value. More... | |
class | garlic::Field |
A named group of Constraint elements. More... | |
struct | garlic::Field::ValidationResult |
List of all failed constraints. More... | |
class | garlic::Model |
An object to describe a Model. More... | |
struct | garlic::Model::FieldDescriptor |
Field Record. More... | |
struct | garlic::model_tag |
Constraint Tag that passes if the specified Model passes the layer. More... | |
struct | garlic::field_tag |
Constraint Tag that passes if the specified Field passes the layer. More... | |
Typedefs | |
using | garlic::constraint_registry = internal::registry< type_tag, range_tag, regex_tag, any_tag, list_tag, tuple_tag, map_tag, all_tag, model_tag, field_tag, string_literal_tag, int_literal_tag, double_literal_tag, bool_literal_tag, null_literal_tag > |
Built-in constraint tags. | |
Functions | |
template<GARLIC_VIEW Layer, typename Container , typename BackInserterIterator > | |
void | garlic::test_constraints (Layer &&value, Container &&constraints, BackInserterIterator it) |
Run a number of constraints on a layer. More... | |
template<GARLIC_VIEW Layer, typename Container > | |
static bool | garlic::test_constraints_quick (Layer &&value, Container &&constraints) |
template<GARLIC_VIEW Layer, typename Container > | |
static ConstraintResult | garlic::test_constraints_first_failure (Layer &&value, Container &&constraints) |
template<typename Tag , typename... Args> | |
Constraint | garlic::make_constraint (Args &&... args) noexcept |
Create a generic Constraint based on a constraint tag. More... | |
Contains constraints, built-in constraint tags, fields and models.
|
inlinenoexcept |
Create a generic Constraint based on a constraint tag.
Tag | any built-in constraint tag that is registered in constraint_registry. |
Args | appropriate set of arguments for the constraint tag used. |
|
inline |
Run a number of constraints on a layer.
Layer | any readable layer that conforms to garlic::ViewLayer concept. |
Container | any constainer that stores a number of Constraint items and has begin() and end() |
it | a back inserter iterator to store ConstraintResult items. |
|
inlinestatic |
Layer | any readable layer that conforms to garlic::ViewLayer concept. |
Container | any constainer that stores a number of Constraint items and has begin() and end() |
|
inlinestatic |
Layer | any readable layer that conforms to garlic::ViewLayer concept. |
Container | any constainer that stores a number of Constraint items and has begin() and end() |