cutelyst
4.3.0
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-2023 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
41
class
CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT
ValidatorDomain
:
public
ValidatorRule
42
{
43
Q_GADGET
44
public
:
48
enum
Diagnose
: quint8 {
49
Valid = 0,
51
MissingDNS = 1,
53
InvalidChars = 2,
54
LabelTooLong =
55
3,
56
TooLong = 4,
57
InvalidLabelCount =
58
5,
59
EmptyLabel = 6,
60
InvalidTLD = 7,
61
DashStart = 8,
62
DashEnd = 9,
63
DigitStart = 10,
64
DNSTimeout = 11
65
};
66
Q_ENUM(Diagnose)
67
68
77
ValidatorDomain
(
const
QString
&field,
78
bool
checkDNS =
false
,
79
const
ValidatorMessages
&messages =
ValidatorMessages
(),
80
const
QString
&defValKey =
QString
());
81
85
~ValidatorDomain
()
override
;
86
99
static
bool
validate(
const
QString
&value,
100
bool
checkDNS,
101
Diagnose
*diagnose =
nullptr
,
102
QString
*extractedValue =
nullptr
);
103
112
static
QString
diagnoseString(
Context
*c,
Diagnose
diagnose,
const
QString
&label =
QString
());
113
114
protected
:
121
ValidatorReturnType
validate(
Context
*c,
const
ParamsMultiMap
¶ms)
const override
;
122
128
QString
genericValidationError(
Context
*c,
129
const
QVariant
&errorData =
QVariant
())
const override
;
130
131
private
:
132
Q_DECLARE_PRIVATE(
ValidatorDomain
)
// NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
133
Q_DISABLE_COPY(
ValidatorDomain
)
134
};
135
136
}
// namespace Cutelyst
137
138
#endif
// CUTELYSTVALIDATORDOMAIN_H
Cutelyst::Context
The Cutelyst Context.
Definition
context.h:42
Cutelyst::ValidatorDomain
Checks if the value of the input field contains a FQDN according to RFC 1035.
Definition
validatordomain.h:42
Cutelyst::ValidatorDomain::~ValidatorDomain
~ValidatorDomain() override
Cutelyst::ValidatorDomain::Diagnose
Diagnose
Possible diagnose information for the checked domain.
Definition
validatordomain.h:48
Cutelyst::ValidatorRule
Base class for all validator rules.
Definition
validatorrule.h:304
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition
group-core-actions.dox:1
QMultiMap
QString
QVariant
Cutelyst::ValidatorMessages
Stores custom error messages and the input field label.
Definition
validatorrule.h:142
Cutelyst::ValidatorReturnType
Contains the result of a single input parameter validation.
Definition
validatorrule.h:49
Cutelyst
Plugins
Utils
Validator
validatordomain.h
Generated by
1.9.8