Cutelyst
3.5.0
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 <Cutelyst/cutelyst_global.h>
10
#include "validatorrule.h"
11
12
namespace
Cutelyst
{
13
14
class
ValidatorDomainPrivate;
15
33
class
CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT
ValidatorDomain
:
public
ValidatorRule
34
{
35
Q_GADGET
36
public
:
40
enum
Diagnose
: quint8 {
41
Valid = 0,
42
MissingDNS = 1,
43
InvalidChars = 2,
44
LabelTooLong = 3,
45
TooLong = 4,
46
InvalidLabelCount = 5,
47
EmptyLabel = 6,
48
InvalidTLD = 7,
49
DashStart = 8,
50
DashEnd = 9,
51
DigitStart = 10,
52
DNSTimeout = 11
53
};
54
Q_ENUM(Diagnose)
55
56
63
ValidatorDomain
(
const
QString
&field,
bool
checkDNS =
false
,
const
ValidatorMessages
&messages =
ValidatorMessages
(),
const
QString
&defValKey =
QString
());
64
68
~
ValidatorDomain
()
override
;
69
79
static
bool
validate(
const
QString
&value,
bool
checkDNS, Diagnose *diagnose =
nullptr
,
QString
*extractedValue =
nullptr
);
80
88
static
QString
diagnoseString(
Context
*c, Diagnose diagnose,
const
QString
&label =
QString
());
89
90
protected
:
97
ValidatorReturnType
validate(
Context
*c,
const
ParamsMultiMap
¶ms)
const override
;
98
104
QString
genericValidationError(
Context
*c,
const
QVariant
&errorData =
QVariant
())
const override
;
105
106
private
:
107
Q_DECLARE_PRIVATE(
ValidatorDomain
)
108
Q_DISABLE_COPY(
ValidatorDomain
)
109
};
110
111
}
112
113
#endif // CUTELYSTVALIDATORDOMAIN_H
Cutelyst::ValidatorDomain
Checks if the value of the input field contains FQDN according to RFC 1035.
Definition:
validatordomain.h:33
Cutelyst::ValidatorMessages
Stores custom error messages and the input field label.
Definition:
validatorrule.h:131
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:279
Cutelyst::ValidatorDomain::Diagnose
Diagnose
Possible diagnose information for the checked domain.
Definition:
validatordomain.h:40
Cutelyst::ValidatorReturnType
Contains the result of a single input parameter validation.
Definition:
validatorrule.h:49
QMultiMap
QVariant
Generated by
1.8.14