6 #include "validatorinteger_p.h" 14 :
ValidatorRule(*new ValidatorIntegerPrivate(field, type, messages, defValKey))
42 converted = d->valueToNumber(c, v, d->type);
46 qCWarning(C_VALIDATOR).noquote()
47 <<
debugString(c) <<
"Conversion type" << d->type <<
"is not an integer type";
52 result.
value = converted;
54 qCDebug(C_VALIDATOR).noquote().nospace()
55 <<
debugString(c) <<
" \"" << v <<
"\" is not parseable as integer value " 56 <<
"or exceeds the limits of the selected type " << d->type;
87 min = c->
locale().
toString(static_cast<qlonglong>(std::numeric_limits<long>::min()));
88 max = c->
locale().
toString(static_cast<qlonglong>(std::numeric_limits<long>::max()));
107 min = c->
locale().
toString(static_cast<qulonglong>(std::numeric_limits<ulong>::min()));
108 max = c->
locale().
toString(static_cast<qulonglong>(std::numeric_limits<ulong>::max()));
112 min = c->
locale().
toString(std::numeric_limits<qulonglong>::min());
113 max = c->
locale().
toString(std::numeric_limits<qulonglong>::max());
119 return c->
qtTrId(
"cutelyst-valinteger-genvalerr").
arg(min, max);
124 return c->
qtTrId(
"cutelyst-valinteger-genvalerr-label").
arg(_label, min, max);
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
Returns a generic error message if validation failed.
ValidatorInteger(const QString &field, QMetaType::Type type=QMetaType::ULongLong, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
Stores custom error messages and the input field label.
~ValidatorInteger() override
QString toString(QDate date, FormatType format) const const
Checks if the value is an integer.
void defaultValue(Context *c, ValidatorReturnType *result) const
bool isEmpty() const const
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
QLocale locale() const noexcept
QString label(Context *c) const
QString value(const ParamsMultiMap ¶ms) 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
bool isValid() const const
Contains the result of a single input parameter validation.
QString arg(Args &&... args) const const
QString debugString(Context *c) const