6 #include "validatoralphadash_p.h"
16 :
ValidatorRule(*new ValidatorAlphaDashPrivate(field, asciiOnly, messages, defValKey))
33 qCDebug(C_VALIDATOR).noquote().nospace()
34 <<
debugString(c) <<
" \"" << v <<
"\" contains character that are not allowed";
49 const ushort &uc = ch.unicode();
50 if (!(((uc >= ValidatorRulePrivate::ascii_A) &&
51 (uc <= ValidatorRulePrivate::ascii_Z)) ||
52 ((uc >= ValidatorRulePrivate::ascii_a) &&
53 (uc <= ValidatorRulePrivate::ascii_z)) ||
54 ((uc >= ValidatorRulePrivate::ascii_0) &&
55 (uc <= ValidatorRulePrivate::ascii_9)) ||
56 (uc == ValidatorRulePrivate::ascii_dash) ||
57 (uc == ValidatorRulePrivate::ascii_underscore))) {
78 return c->
qtTrId(
"cutelyst-valalphadash-genvalerr-asciionly");
81 return c->
qtTrId(
"cutelyst-valalphadash-genvalerr");
89 return c->
qtTrId(
"cutelyst-valalphadash-genvalerr-asciionly-label").
arg(_label);
94 return c->
qtTrId(
"cutelyst-valalphadash-genvalerr-label").
arg(_label);
QString qtTrId(const char *id, int n=-1) const
Checks a value for only alpha-numeric content and dashes and underscores.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
ValidatorAlphaDash(const QString &field, bool asciiOnly=false, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
~ValidatorAlphaDash() override
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
static bool validate(const QString &value, bool asciiOnly=false)
Returns true if the value only contains alpha-numeric characters, dashes and underscores.
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.