cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatordomain.h
1/*
2 * SPDX-FileCopyrightText: (C) 2018-2022 Matthias Fehring <mf@huessenbergnetz.de>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef CUTELYSTVALIDATORDOMAIN_H
7#define CUTELYSTVALIDATORDOMAIN_H
8
9#include "validatorrule.h"
10
11#include <Cutelyst/cutelyst_global.h>
12
13namespace Cutelyst {
14
15class ValidatorDomainPrivate;
16
37class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDomain : public ValidatorRule
38{
39 Q_GADGET
40public:
62 Q_ENUM(Diagnose)
63
64
72 ValidatorDomain(const QString &field,
73 bool checkDNS = false,
74 const ValidatorMessages &messages = ValidatorMessages(),
75 const QString &defValKey = QString());
76
80 ~ValidatorDomain() override;
81
92 static bool validate(const QString &value,
93 bool checkDNS,
94 Diagnose *diagnose = nullptr,
95 QString *extractedValue = nullptr);
96
104 static QString diagnoseString(Context *c, Diagnose diagnose, const QString &label = QString());
105
106protected:
113 ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
114
120 QString genericValidationError(Context *c,
121 const QVariant &errorData = QVariant()) const override;
122
123private:
124 Q_DECLARE_PRIVATE(ValidatorDomain)
125 Q_DISABLE_COPY(ValidatorDomain)
126};
127
128} // namespace Cutelyst
129
130#endif // CUTELYSTVALIDATORDOMAIN_H
The Cutelyst Context.
Definition context.h:39
Checks if the value of the input field contains FQDN according to RFC 1035.
ValidatorDomain(const QString &field, bool checkDNS=false, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
Constructs a new ValidatorDomain with the given parameters.
Diagnose
Possible diagnose information for the checked domain.
ValidatorRule(const QString &field, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
Constructs a new ValidatorRule with the given parameters.
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.