6 #include "validatorurl_p.h" 13 Constraints constraints,
17 :
ValidatorRule(*new ValidatorUrlPrivate(field, constraints, schemes, messages, defValKey))
40 QUrl url(v, parsingMode);
60 ?
QStringList({QStringLiteral(
"http"), QStringLiteral(
"https")})
74 if (!schemeList.
empty()) {
77 bool foundScheme =
false;
78 for (
const QString &s : schemeList) {
94 qCDebug(C_VALIDATOR).noquote() <<
debugString(c) <<
"Not a valid URL";
111 return c->
qtTrId(
"cutelyst-valurl-genvalerr");
115 return c->
qtTrId(
"cutelyst-valurl-genvalerr-label").
arg(_label);
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
Stores custom error messages and the input field label.
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
ValidatorUrl(const QString &field, Constraints constraints=NoConstraint, const QStringList &schemes=QStringList(), const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
bool isEmpty() const const
void defaultValue(Context *c, ValidatorReturnType *result) const
bool isEmpty() const const
The field under validation must be a valid URL.
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
QString label(Context *c) const
QString scheme() const const
QString toLower() const const
QString value(const ParamsMultiMap ¶ms) const
QString validationError(Context *c, const QVariant &errorData={}) const
bool isValid() const const
QString qtTrId(const char *id, int n=-1) const
bool isRelative() const const
Contains the result of a single input parameter validation.
QString arg(Args &&... args) const const
QString debugString(Context *c) const
void setValue(QVariant &&value)
bool isLocalFile() const const