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);
QString qtTrId(const char *id, int n=-1) const
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
The field under validation must be a valid URL.
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())
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
The Cutelyst namespace holds all public Cutelyst API.
QString arg(Args &&... args) const const
bool isEmpty() const const
QString toLower() const const
bool isEmpty() const const
bool isLocalFile() const const
bool isRelative() const const
bool isValid() const const
QString scheme() const const
void setValue(QVariant &&value)
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.