6 #include "validatordate_p.h"
13 const char *inputFormat,
16 :
ValidatorRule(*new ValidatorDatePrivate(field, inputFormat, messages, defValKey))
31 const QDate date = d->extractDate(c, v, d->inputFormat);
35 qCDebug(C_VALIDATOR).noquote().nospace()
36 <<
debugString(c) <<
" \"" << v <<
"\" is not a valid date";
55 const QString inputFormatTranslated =
56 d->translationContext ? c->
translate(d->translationContext, d->inputFormat)
57 : c->
qtTrId(d->inputFormat);
61 return c->
qtTrId(
"cutelyst-valdate-genvalerr-format").
arg(inputFormatTranslated);
67 return c->
qtTrId(
"cutelyst-valdate-genvalerr-format-label")
68 .
arg(_label, inputFormatTranslated);
73 return c->
qtTrId(
"cutelyst-valdate-genvalerr");
77 return c->
qtTrId(
"cutelyst-valdate-genvalerr-label").
arg(_label);
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 the input data is a valid date.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
~ValidatorDate() override
ValidatorDate(const QString &field, const char *inputFormat=nullptr, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
Base class for all validator rules.
QString validationError(Context *c, const QVariant &errorData={}) const
QString label(Context *c) 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.
bool isValid(int year, int month, int day)
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.