6 #include "validatoralphanum_p.h" 17 :
ValidatorRule(*new ValidatorAlphaNumPrivate(field, asciiOnly, messages, defValKey))
34 qCDebug(C_VALIDATOR).noquote().nospace()
35 <<
debugString(c) <<
" \"" << v <<
"\" contains character that are not allowed";
51 const ushort &uc = ch.unicode();
52 if (!(((uc >= ValidatorRulePrivate::ascii_A) &&
53 (uc <= ValidatorRulePrivate::ascii_Z)) ||
54 ((uc >= ValidatorRulePrivate::ascii_a) &&
55 (uc <= ValidatorRulePrivate::ascii_z)) ||
56 ((uc >= ValidatorRulePrivate::ascii_0) &&
57 (uc <= ValidatorRulePrivate::ascii_9)))) {
78 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr-asciionly");
81 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr");
88 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr-asciionly-label").
arg(_label);
92 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr-label").
arg(_label);
Stores custom error messages and the input field label.
void defaultValue(Context *c, ValidatorReturnType *result) const
~ValidatorAlphaNum() override
Checks a value for only alpha-numeric content.
bool isEmpty() const const
The Cutelyst namespace holds all public Cutelyst API.
ValidatorAlphaNum(const QString &field, bool asciiOnly=false, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
Base class for all validator rules.
QString label(Context *c) const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString value(const ParamsMultiMap ¶ms) const
QString validationError(Context *c, const QVariant &errorData={}) const
QString qtTrId(const char *id, int n=-1) const
static bool validate(const QString &value, bool asciiOnly=false)
Returns true if value only contains alpha-numeric characters.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
Contains the result of a single input parameter validation.
QString arg(Args &&... args) const const
QString debugString(Context *c) const
void setValue(QVariant &&value)