6 #include "validatoralpha_p.h" 16 :
ValidatorRule(*new ValidatorAlphaPrivate(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)))) {
76 return c->
qtTrId(
"cutelyst-valalpha-genvalerr-asciionly");
79 return c->
qtTrId(
"cutelyst-valalpha-genvalerr");
86 return c->
qtTrId(
"cutelyst-valalpha-genvalerr-asciionly-label").
arg(_label);
90 return c->
qtTrId(
"cutelyst-valalpha-genvalerr-label").
arg(_label);
static bool validate(const QString &value, bool asciiOnly=false)
Returns true if value only contains alphabetic characters.
ValidatorAlpha(const QString &field, bool asciiOnly=false, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
Stores custom error messages and the input field label.
Validates an input field for only alphabetic content.
void defaultValue(Context *c, ValidatorReturnType *result) const
bool isEmpty() const const
The Cutelyst namespace holds all public Cutelyst API.
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
~ValidatorAlpha() override
QString validationError(Context *c, const QVariant &errorData={}) const
QString qtTrId(const char *id, int n=-1) const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
Contains the result of a single input parameter validation.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
QString debugString(Context *c) const