6 #include "validatorregularexpression_p.h"
14 :
ValidatorRule(*new ValidatorRegularExpressionPrivate(field, regex, messages, defValKey))
29 if (d->regex.isValid()) {
35 qCDebug(C_VALIDATOR).noquote().nospace()
36 <<
debugString(c) <<
" value \"" << v <<
"\" does not match " << d->regex;
43 qCWarning(C_VALIDATOR).noquote().nospace()
44 <<
debugString(c) <<
" the regular expression is not valid: " << d->regex.errorString();
57 return c->
qtTrId(
"cutelyst-valregex-genvalerr");
61 return c->
qtTrId(
"cutelyst-valregex-genvalerr-label").
arg(_label);
QString qtTrId(const char *id, int n=-1) const
The field under validation must match the given regular expression.
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
~ValidatorRegularExpression() override
ValidatorRegularExpression(const QString &field, const QRegularExpression ®ex, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
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 arg(Args &&... args) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) 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.