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);
QString qtTrId(const char *id, int n=-1) const
Validates an input field for only alphabetic content.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
~ValidatorAlpha() override
ValidatorAlpha(const QString &field, bool asciiOnly=false, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
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 alphabetic 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.