garlic::Field Class Reference

A named group of Constraint elements. More...

#include <constraints.h>

Data Structures

struct  ValidationResult
 List of all failed constraints. More...
 

Public Member Functions

 Field (text &&name)
 Create an empty Field by a name.
 
 Field (text &&name, sequence< Constraint > &&constraints)
 Create a Field by a name and a defined set of constraints.
 
template<typename Tag , typename... Args>
void add_constraint (Args &&... args) noexcept
 Helper method to create and add a constriant to the Field. More...
 
void add_constraint (Constraint &&constraint)
 Add a constraint to the Field.
 
void inherit_constraints_from (const Field &another)
 Adds all the constraints from the specified field to the front.
 
auto & annotations () noexcept
 
const auto & annotations () const noexcept
 
bool ignore_details () const
 
void set_ignore_details (bool value)
 Set whether or not the field should ignore details.
 
text message () const noexcept
 
const textname () const noexcept
 
const_constraint_iterator begin_constraints () const noexcept
 
const_constraint_iterator end_constraints () const noexcept
 
template<GARLIC_VIEW Layer>
ValidationResult validate (const Layer &layer) const noexcept
 test the layer with all the constraints in the field.
 
template<GARLIC_VIEW Layer>
bool quick_test (const Layer &layer) const noexcept
 perform a quick and efficient test of all constraints in the field.
 

Detailed Description

A named group of Constraint elements.

Member Function Documentation

◆ add_constraint()

template<typename Tag , typename... Args>
void garlic::Field::add_constraint ( Args &&...  args)
inlinenoexcept

Helper method to create and add a constriant to the Field.

Uses make_constraint() and adds the resulting Constraint to the Filed.

◆ annotations() [1/2]

const auto& garlic::Field::annotations ( ) const
inlinenoexcept
Returns
annotations object.

◆ annotations() [2/2]

auto& garlic::Field::annotations ( )
inlinenoexcept
Returns
annotations object.

◆ begin_constraints()

const_constraint_iterator garlic::Field::begin_constraints ( ) const
inlinenoexcept
Returns
an iterator (const) pointing to the first constraint in the field.

◆ end_constraints()

const_constraint_iterator garlic::Field::end_constraints ( ) const
inlinenoexcept
Returns
an iterator (const) pointing to one past the last constraint in the field.

◆ ignore_details()

bool garlic::Field::ignore_details ( ) const
inline
Returns
whether or not the field should ignore details and return a leaf ConstraintResult when testing/validating.

◆ message()

text garlic::Field::message ( ) const
inlinenoexcept
Returns
the message to display when making failed ConstraintResult instances.

◆ name()

const text& garlic::Field::name ( ) const
inlinenoexcept
Returns
name of the field.

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