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);
QLocale locale() const noexcept
QString qtTrId(const char *id, int n=-1) const
Checks if the value is an integer.
~ValidatorInteger() override
ValidatorInteger(const QString &field, QMetaType::Type type=QMetaType::ULongLong, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
Returns a generic error message if validation failed.
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 toString(QDate date, QLocale::FormatType format) const const
QString arg(Args &&... args) const const
bool isEmpty() const const
bool isValid() const const
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.