6 #include "validatordatetime_p.h"
14 const char *inputFormat,
18 *new ValidatorDateTimePrivate(field, timeZone, inputFormat, messages, defValKey))
33 const QTimeZone tz = d->extractTimeZone(c, params, d->timeZone);
34 const QDateTime dt = d->extractDateTime(c, v, d->inputFormat, tz);
38 qCDebug(C_VALIDATOR).noquote().nospace()
39 <<
debugString(c) <<
" \"" << v <<
"\" is not a valid datetime";
59 const QString inputFormatTranslated =
60 d->translationContext ? c->
translate(d->translationContext, d->inputFormat)
61 : c->
qtTrId(d->inputFormat);
65 return c->
qtTrId(
"cutelyst-valdatetime-genvalerr-format").
arg(inputFormatTranslated);
71 return c->
qtTrId(
"cutelyst-valdatetime-genvalerr-format-label")
72 .
arg(_label, inputFormatTranslated);
77 return c->
qtTrId(
"cutelyst-valdatetime-genvalerr");
81 return c->
qtTrId(
"cutelyst-valdatetime-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 datetime.
ValidatorDateTime(const QString &field, const QString &timeZone, const char *inputFormat=nullptr, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
~ValidatorDateTime() override
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
Returns a generic error if validation failed.
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() const const
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.