6#include "validatorurl_p.h"
11using namespace Qt::StringLiterals;
14 Constraints constraints,
18 :
ValidatorRule(*new ValidatorUrlPrivate(
field, constraints, schemes, messages, defValKey))
58 if (!schemeList.
empty()) {
60 bool foundScheme =
false;
61 for (
const QString &s : schemeList) {
75 qCDebug(C_VALIDATOR).noquote() <<
debugString(c) <<
"Not a valid URL";
97 return c->
qtTrId(
"cutelyst-valurl-genvalerr");
101 return c->
qtTrId(
"cutelyst-valurl-genvalerr-label").
arg(_label);
QString qtTrId(const char *id, int n=-1) const
QString field() const noexcept
QString validationError(Context *c, const QVariant &errorData={}) const
QString label(const Context *c) const
QString debugString(const Context *c) const
ValidatorRule(const QString &field, const ValidatorMessages &messages={}, const QString &defValKey={}, QByteArrayView validatorName=nullptr)
std::function< void(ValidatorReturnType &&result)> ValidatorRtFn
Void callback function for validator rules that processes the ValidatorReturnType.
void defaultValue(Context *c, ValidatorReturnType *result) const
QString value(const ParamsMultiMap ¶ms) const
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
void validateCb(Context *c, const ParamsMultiMap ¶ms, ValidatorRtFn cb) const override
ValidatorUrl(const QString &field, Constraints constraints=NoConstraint, const QStringList &schemes={}, const ValidatorMessages &messages={}, const QString &defValKey={})
QMultiMap< QString, QString > ParamsMultiMap
The Cutelyst namespace holds all public Cutelyst API.
QString arg(Args &&... args) const const
bool isEmpty() const const
QString toLower() const const
QStringList(QList< QString > &&other)
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.