6#include "validatorin_p.h"
15 :
ValidatorRule(*new ValidatorInPrivate(field, values, cs, messages, defValKey))
32 vals = d->values.toStringList();
34 vals = c->
stash(d->values.toString()).toStringList();
39 qCWarning(C_VALIDATOR).noquote()
40 <<
debugString(c) <<
"The list of comparison values is emtpy";
45 qCDebug(C_VALIDATOR).noquote().nospace()
46 <<
debugString(c) <<
" \"" << v <<
"\" is not part of the comparison list "
70 return c->
qtTrId(
"cutelyst-valin-genvalerr-label")
81 return c->
qtTrId(
"cutelyst-validator-genvaldataerr-empty-list");
85 return c->
qtTrId(
"cutelyst-validator-genvaldataerr-empty-list-label").
arg(_label);
void stash(const QVariantHash &unite)
QLocale locale() const noexcept
QString qtTrId(const char *id, int n=-1) const
Checks if the field value is one from a list of values.
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
ValidatorIn(const QString &field, const QVariant &values, Qt::CaseSensitivity cs=Qt::CaseSensitive, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
QString genericValidationDataError(Context *c, const QVariant &errorData) 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
QString validationDataError(Context *c, const QVariant &errorData={}) const
void defaultValue(Context *c, ValidatorReturnType *result) const
QString value(const ParamsMultiMap ¶ms) const
QString debugString(Context *c) const
The Cutelyst namespace holds all public Cutelyst API.
QString createSeparatedList(const QStringList &list) const const
QString arg(Args &&... args) const const
bool isEmpty() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
void setValue(QVariant &&value)
QStringList toStringList() const const
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.