6 #include "validatorsame_p.h" 12 const char *otherLabel,
15 :
ValidatorRule(*new ValidatorSamePrivate(field, otherField, otherLabel, messages, defValKey))
34 qCDebug(C_VALIDATOR).noquote().nospace()
35 <<
debugString(c) <<
" The value in \"" << d->otherField
36 <<
"\" is not the same: " << v <<
" != " << ov;
54 _olabel = d->translationContext ? c->
translate(d->translationContext, d->otherLabel)
55 : c->
qtTrId(d->otherLabel);
57 _olabel = d->otherField;
63 return c->
qtTrId(
"cutelyst-valsame-genvalerr").
arg(_olabel);
68 return c->
qtTrId(
"cutelyst-valsame-genvalerr-label").
arg(_label, _olabel);
Stores custom error messages and the input field label.
~ValidatorSame() override
bool trimBefore() const noexcept
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
void defaultValue(Context *c, ValidatorReturnType *result) const
bool isEmpty() const const
QString translate(const char *context, const char *sourceText, const char *disambiguation=nullptr, int n=-1) const
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
QString label(Context *c) const
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
ValidatorSame(const QString &field, const QString &otherField, const char *otherLabel=nullptr, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
QString value(const ParamsMultiMap ¶ms) const
QString validationError(Context *c, const QVariant &errorData={}) const
QString qtTrId(const char *id, int n=-1) const
Contains the result of a single input parameter validation.
QString arg(Args &&... args) const const
QString debugString(Context *c) const
T value(const Key &key, const T &defaultValue) const const
void setValue(QVariant &&value)
The given field must match the field under validation.