6#include "validatoralphanum_p.h"
16 :
ValidatorRule(*new ValidatorAlphaNumPrivate(field, asciiOnly, messages, defValKey))
33 qCDebug(C_VALIDATOR).noquote().nospace()
34 <<
debugString(c) <<
" \"" << v <<
"\" contains character that are not allowed";
50 const ushort &uc = ch.unicode();
51 if (!(((uc >= ValidatorRulePrivate::ascii_A) &&
52 (uc <= ValidatorRulePrivate::ascii_Z)) ||
53 ((uc >= ValidatorRulePrivate::ascii_a) &&
54 (uc <= ValidatorRulePrivate::ascii_z)) ||
55 ((uc >= ValidatorRulePrivate::ascii_0) &&
56 (uc <= ValidatorRulePrivate::ascii_9)))) {
77 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr-asciionly");
80 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr");
87 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr-asciionly-label").
arg(_label);
91 return c->
qtTrId(
"cutelyst-valalphanum-genvalerr-label").
arg(_label);
QString qtTrId(const char *id, int n=-1) const
Checks a value for only alpha-numeric content.
ValidatorAlphaNum(const QString &field, bool asciiOnly=false, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
~ValidatorAlphaNum() 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 value only contains alpha-numeric characters.
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.