|
Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
|
#include <validator.hpp>
Public Types | |
| using | Rule = std::function<std::optional<std::string>(const T&)> |
| User-supplied rule body: returns a message when the value fails, std::nullopt when it passes. | |
Public Member Functions | |
| Validator (Property< T > &source, std::string field_path={}) | |
| ~Validator () | |
| const std::string & | field_path () const noexcept |
| Validator & | rule (Rule r, std::string rule_id_value={}) |
| template<std::predicate< const T & > P> | |
| Validator & | must (P &&predicate, std::string message, std::string rule_id_value={}) |
| Validator & | warning (Rule r, std::string rule_id_value={}) |
| template<std::predicate< const T & > P> | |
| Validator & | should (P &&predicate, std::string message, std::string rule_id_value={}) |
| Validator & | rules (std::initializer_list< Rule > rs) |
| void | touch () |
| void | reset_touched () |
| void | reset_dirty () |
| void | begin_pending () |
| void | end_pending (std::vector< std::string > extra_messages) |
| Settle the async validation: clears pending and stores extra_messages as additional Error-severity entries until the next sync run replaces them. | |
| void | end_pending (std::vector< Error > extra) |
| Settle pending with caller-shaped error records. | |
| void | end_pending () |
| Settle pending without any extra errors. | |
| void | cancel_pending () |
| Cancel pending work while preserving the previous validation result, including async errors and warnings. | |
| Property< ValidationState > & | state () noexcept |
| const Property< ValidationState > & | state () const noexcept |
| Property< ValidationResult > & | result () noexcept |
| const Property< ValidationResult > & | result () const noexcept |
Friends | |
| template<class U> | |
| class | async::AsyncValidator |
| using aria::Validator< T >::Rule = std::function<std::optional<std::string>(const T&)> |
User-supplied rule body: returns a message when the value fails, std::nullopt when it passes.
The framework wraps the returned message into an Error (kind = Validation) together with the owning Validator's field_path and either an explicit or auto-generated rule_id.
|
inlineexplicit |
|
inline |
|
inlinenodiscardnoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Settle the async validation: clears pending and stores extra_messages as additional Error-severity entries until the next sync run replaces them.
Each entry is keyed under this validator's field_path and an auto-generated async_<N> rule_id.
|
inline |
Settle pending with caller-shaped error records.
Empty field_paths are backfilled with the validator's own.
|
inline |
Settle pending without any extra errors.
|
inline |
Cancel pending work while preserving the previous validation result, including async errors and warnings.
Cancellation is not a new result.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |