|
cppfig 0.1.0
Modern C++20 compile-time type-safe configuration library
|
Type-erased validator that can hold any validation function. More...
#include <validator.h>
Public Types | |
| using | validator_fn = std::function< ValidationResult(const T &)> |
Public Member Functions | |
| Validator () | |
| Creates an always-valid validator. | |
| Validator (validator_fn fn) | |
| Creates a validator from a function. | |
| auto | operator() (const T &value) const -> ValidationResult |
| Validates a value. | |
| auto | And (Validator< T > other) const -> Validator< T > |
| Combines this validator with another (both must pass). | |
| auto | Or (Validator< T > other) const -> Validator< T > |
| Combines this validator with another (either must pass). | |
Type-erased validator that can hold any validation function.
| using cppfig::Validator< T >::validator_fn = std::function<ValidationResult(const T&)> |
|
inline |
Creates an always-valid validator.
|
inlineexplicit |
Creates a validator from a function.
|
inline |
Combines this validator with another (both must pass).
|
inline |
Validates a value.
|
inline |
Combines this validator with another (either must pass).