6 #include "validatortime_p.h"
16 :
ValidatorRule(*new ValidatorTimePrivate(field, format, messages, defValKey))
31 const QTime time = d->extractTime(c, v, d->format);
35 qCDebug(C_VALIDATOR).noquote().nospace()
36 <<
debugString(c) <<
" \"" << v <<
"\" is not a valid time";
55 const QString _formatTranslated = d->translationContext
56 ? c->
translate(d->translationContext, d->format)
60 return c->
qtTrId(
"cutelyst-valtime-genvalerr-format").
arg(_formatTranslated);
64 return c->
qtTrId(
"cutelyst-valtime-genvalerr-format-label")
65 .
arg(_label, _formatTranslated);
70 return c->
qtTrId(
"cutelyst-valtime-genvalerr");
73 return c->
qtTrId(
"cutelyst-valtime-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
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
Checks if the input data is a valid time.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
ValidatorTime(const QString &field, const char *format=nullptr, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
~ValidatorTime() override
The Cutelyst namespace holds all public Cutelyst API.
QString arg(Args &&... args) const const
bool isEmpty() const const
bool isValid(int h, int m, int s, int ms)
void setValue(QVariant &&value)
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.