5 #ifndef CUTELYSTVALIDATORRULE_H 6 #define CUTELYSTVALIDATORRULE_H 8 #include <Cutelyst/Plugins/Utils/validator_export.h> 9 #include <Cutelyst/context.h> 10 #include <Cutelyst/paramsmultimap.h> 13 #include <QLoggingCategory> 15 #include <QScopedPointer> 18 Q_DECLARE_LOGGING_CATEGORY(C_VALIDATOR)
68 explicit operator bool() const noexcept {
return errorMessage.
isNull(); }
73 [[nodiscard]]
bool isValid() const noexcept {
return errorMessage.
isNull(); }
82 using ValidatorRtFn = std::function<void(ValidatorReturnType &&result)>;
170 const char *customValidationError =
nullptr,
171 const char *customParsingError =
nullptr,
172 const char *customValidationDataError =
nullptr)
174 , validationError(customValidationError)
175 , parsingError(customParsingError)
176 , validationDataError(customValidationDataError)
179 const char *label =
nullptr;
180 const char *validationError =
nullptr;
181 const char *parsingError =
nullptr;
182 const char *validationDataError =
nullptr;
185 class ValidatorRulePrivate;
378 const std::unique_ptr<ValidatorRulePrivate> d_ptr;
481 [[nodiscard]]
QString field()
const noexcept;
500 [[nodiscard]]
bool trimBefore()
const noexcept;
676 void setTranslationContext(
const char *trContext) noexcept;
688 void setTrimBefore(
bool trimBefore) noexcept;
691 friend class ValidatorPrivate;
692 friend class AsyncValidator;
697 #endif // CUTELYSTVALIDATORRULE_H Stores custom error messages and the input field label.
bool isNull() const const
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
Validation processor for input data.
std::function< void(ValidatorReturnType &&result)> ValidatorRtFn
Void callback function for validator rules that processes the ValidatorReturnType.
Contains the result of a single input parameter validation.
ValidatorMessages(const char *customLabel, const char *customValidationError=nullptr, const char *customParsingError=nullptr, const char *customValidationDataError=nullptr)
Constructs a new ValidatorMessages object with the given parameters.
bool isValid() const noexcept