6 #include "validatordifferent_p.h"
12 const char *otherLabel,
14 :
ValidatorRule(*new ValidatorDifferentPrivate(field, other, otherLabel, messages))
33 qCDebug(C_VALIDATOR).noquote().nospace()
34 <<
debugString(c) <<
" The value in \"" << d->otherField
35 <<
"\" is not different: \"" << v <<
"\" == \"" << o <<
"\"";
53 return d->translationContext ? c->
translate(d->translationContext, d->otherLabel)
54 : c->
qtTrId(d->otherLabel);
63 return c->
qtTrId(
"cutelyst-valdifferent-genvalerr")
64 .
arg(!_otherLabel.
isEmpty() ? _otherLabel : d->otherField);
69 return c->
qtTrId(
"cutelyst-valdifferent-genvalerr-label")
70 .
arg(_label, !_otherLabel.
isEmpty() ? _otherLabel : d->otherField);
QString translate(const char *context, const char *sourceText, const char *disambiguation=nullptr, int n=-1) const
QString qtTrId(const char *id, int n=-1) const
Checks if two values are different.
ValidatorDifferent(const QString &field, const QString &other, const char *otherLabel=nullptr, const ValidatorMessages &messages=ValidatorMessages())
~ValidatorDifferent() override
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
Base class for all validator rules.
QString validationError(Context *c, const QVariant &errorData={}) const
QString label(Context *c) const
bool trimBefore() const noexcept
QString value(const ParamsMultiMap ¶ms) const
QString debugString(Context *c) const
The Cutelyst namespace holds all public Cutelyst API.
T value(const Key &key, const T &defaultValue) const const
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.