6 #include "validatorrequiredwithout_p.h" 13 :
ValidatorRule(*new ValidatorRequiredWithoutPrivate(field, otherFields, messages))
26 if (d->otherFields.isEmpty()) {
28 qCWarning(C_VALIDATOR).noquote() <<
"Invalid validation data";
31 bool otherMissing =
false;
36 for (
const QString &other : ofc) {
51 qCDebug(C_VALIDATOR).noquote().nospace()
52 <<
debugString(c) <<
" The field is not present or empty but the field \"" 53 << otherField <<
"\" is not present";
72 return c->
qtTrId(
"cutelyst-validator-genvalerr-req");
74 return c->
qtTrId(
"cutelyst-validator-genvalerr-req-label").
arg(_label);
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
~ValidatorRequiredWithout() override
Stores custom error messages and the input field label.
bool isEmpty() const const
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
QString label(Context *c) const
ValidatorRequiredWithout(const QString &field, const QStringList &otherFields, const ValidatorMessages &messages=ValidatorMessages())
QString value(const ParamsMultiMap ¶ms) const
bool contains(const Key &key) const const
QString validationError(Context *c, const QVariant &errorData={}) const
QString validationDataError(Context *c, const QVariant &errorData={}) const
QString qtTrId(const char *id, int n=-1) const
The field under validation must be present and not empty only if any of the other specified fields is...
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
Contains the result of a single input parameter validation.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
QString debugString(Context *c) const