5#ifndef CUTELYSTVALIDATOREMAIL_H
6#define CUTELYSTVALIDATOREMAIL_H
8#include "validatorrule.h"
12class ValidatorEmailPrivate;
78 RFC5321QuotedString = 11,
79 RFC5321AddressLiteral = 12,
80 RFC5321IPv6Deprecated =
88 DeprecatedLocalpart = 33,
92 DeprecatedComment = 37,
94 DeprecatedCFWSNearAt =
102 RFC5322LocalTooLong = 67,
103 RFC5322DomainTooLong = 68,
104 RFC5322LabelTooLong = 69,
105 RFC5322DomainLiteral =
108 RFC5322DomLitOBSDText = 71,
111 RFC5322IPv6GroupCount =
113 RFC5322IPv62x2xColon = 73,
114 RFC5322IPv6BadChar = 74,
115 RFC5322IPv6MaxGroups = 75,
116 RFC5322IPv6ColonStart = 76,
117 RFC5322IPv6ColonEnd = 77,
119 ErrorExpectingDText =
121 ErrorNoLocalPart = 130,
123 ErrorConsecutiveDots = 132,
124 ErrorATextAfterCFWS =
126 ErrorATextAfterQS = 134,
127 ErrorATextAfterDomLit =
129 ErrorExpectingQpair =
131 ErrorExpectingAText = 137,
132 ErrorExpectingQText = 138,
133 ErrorExpectingCText = 139,
134 ErrorBackslashEnd = 140,
137 ErrorDomainHyphenStart = 143,
138 ErrorDomainHyphenEnd = 144,
139 ErrorUnclosedQuotedStr = 145,
140 ErrorUnclosedComment = 146,
141 ErrorUnclosedDomLiteral = 147,
142 ErrorFWSCRLFx2 = 148,
143 ErrorFWSCRLFEnd = 149,
161 RFC5321 = CFWSComment,
164 CFWS = DeprecatedLocalpart,
166 Deprecated = RFC5322Domain,
168 RFC5322 = ErrorExpectingDText,
182 AllowUTF8 = UTF8Local | AllowIDN
185 Q_DECLARE_FLAGS(Options, Option)
197 Category threshold = RFC5321,
198 Options options = NoOption,
200 const QString &defValKey = {});
214 static QString diagnoseString(
Context *c,
Diagnose diagnose,
const QString &label = {});
223 static QString categoryString(
Context *c, Category category,
const QString &label = {});
230 static Category category(Diagnose diagnose);
240 static QString categoryString(Context *c, Diagnose diagnose,
const QString &label = {});
259 Options options = NoOption,
260 QList<Diagnose> *diagnoses =
nullptr);
276 static void validateCb(
277 const QString &email,
281 void(
bool isValid,
const QString &cleanedEmail,
const QList<Diagnose> &diagnoses)> cb);
313 QString genericValidationError(
Context *c,
314 const QVariant &errorData = QVariant())
const override;
323Q_DECLARE_OPERATORS_FOR_FLAGS(Cutelyst::ValidatorEmail::Options)
Checks if the value is a valid email address according to specific RFCs.
Category
Validation category, used as threshold to define valid addresses.
~ValidatorEmail() override
Diagnose
Single diagnose values that show why an address is not valid.
Base class for all validator rules.
std::function< void(ValidatorReturnType &&result)> ValidatorRtFn
Void callback function for validator rules that processes the ValidatorReturnType.
QMultiMap< QString, QString > ParamsMultiMap
static bool validate(const QString &email, Category threshold=RFC5321, Options options=NoOption, QList< Diagnose > *diagnoses=nullptr)
Returns true if email is a valid address according to the Category given in the threshold.
The Cutelyst namespace holds all public Cutelyst API.
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.