cutelyst
3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst
Plugins
Utils
Validator
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
13
namespace
Cutelyst
{
14
15
class
ValidatorDomainPrivate;
16
37
class
CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT
ValidatorDomain
:
public
ValidatorRule
38
{
39
Q_GADGET
40
public
:
44
enum
Diagnose
: quint8 {
45
Valid = 0,
47
MissingDNS = 1,
49
InvalidChars = 2,
50
LabelTooLong =
51
3,
52
TooLong = 4,
53
InvalidLabelCount =
54
5,
55
EmptyLabel = 6,
56
InvalidTLD = 7,
57
DashStart = 8,
58
DashEnd = 9,
59
DigitStart = 10,
60
DNSTimeout = 11
61
};
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
106
protected
:
113
ValidatorReturnType
validate(
Context
*c,
const
ParamsMultiMap
¶ms)
const override
;
114
120
QString
genericValidationError(
Context
*c,
121
const
QVariant
&errorData =
QVariant
())
const override
;
122
123
private
:
124
Q_DECLARE_PRIVATE(
ValidatorDomain
)
125
Q_DISABLE_COPY(
ValidatorDomain
)
126
};
127
128
}
// namespace Cutelyst
129
130
#endif // CUTELYSTVALIDATORDOMAIN_H
Cutelyst::ValidatorDomain
Checks if the value of the input field contains FQDN according to RFC 1035.
Definition:
validatordomain.h:37
Cutelyst::ValidatorMessages
Stores custom error messages and the input field label.
Definition:
validatorrule.h:141
Cutelyst::Context
The Cutelyst Context.
Definition:
context.h:38
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition:
Mainpage.dox:7
QString
Cutelyst::ValidatorRule
Base class for all validator rules.
Definition:
validatorrule.h:300
Cutelyst::ValidatorDomain::Diagnose
Diagnose
Possible diagnose information for the checked domain.
Definition:
validatordomain.h:44
Cutelyst::ValidatorReturnType
Contains the result of a single input parameter validation.
Definition:
validatorrule.h:49
QMultiMap
QVariant
Generated by
1.8.14