6#include "validatorrequiredwithoutall_p.h"
14 :
ValidatorRule(*new ValidatorRequiredWithoutAllPrivate(field, otherFields, messages))
27 if (d->otherFields.empty()) {
29 qCWarning(C_VALIDATOR).noquote() <<
"Invalid validation data";
31 const bool withoutAll = std::ranges::none_of(
32 d->otherFields, [params](
const QString &other) { return params.contains(other); });
42 <<
"The field is not present or empty and all of "
43 "the other fields are not present";
69 return c->
qtTrId(
"cutelyst-validator-genvalerr-req");
71 return c->
qtTrId(
"cutelyst-validator-genvalerr-req-label").
arg(_label);
QString qtTrId(const char *id, int n=-1) const
The field under validation must be present and not empty only when all of the other specified fields ...
void validateCb(Context *c, const ParamsMultiMap ¶ms, ValidatorRtFn cb) const override
~ValidatorRequiredWithoutAll() override
ValidatorRequiredWithoutAll(const QString &field, const QStringList &otherFields, const ValidatorMessages &messages=ValidatorMessages())
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
Base class for all validator rules.
QString validationError(Context *c, const QVariant &errorData={}) const
QString label(const Context *c) const
QString debugString(const Context *c) const
QString validationDataError(Context *c, const QVariant &errorData={}) const
std::function< void(ValidatorReturnType &&result)> ValidatorRtFn
Void callback function for validator rules that processes the ValidatorReturnType.
QString value(const ParamsMultiMap ¶ms) const
The Cutelyst namespace holds all public Cutelyst API.
QString arg(Args &&... args) const const
bool isEmpty() const const
void setValue(QVariant &&value)
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.