cutelyst 4.8.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatorcharnotallowed.h
1/*
2 * SPDX-FileCopyrightText: (C) 2019-2023 Matthias Fehring <mf@huessenbergnetz.de>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef CUTELYSTVALIDATORCHARNOTALLOWED_H
7#define CUTELYSTVALIDATORCHARNOTALLOWED_H
8
9#include "validatorrule.h"
10
11namespace Cutelyst {
12
13class ValidatorCharNotAllowedPrivate;
14
38class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorCharNotAllowed : public ValidatorRule
39{
40public:
50 ValidatorCharNotAllowed(const QString &field,
51 const QString &forbiddenChars,
52 const ValidatorMessages &messages = ValidatorMessages(),
53 const QString &defValKey = QString());
54
59
69 static bool
70 validate(const QString &value, const QString &forbiddenChars, QChar *foundChar = nullptr);
71
72protected:
79 ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
80
84 QString genericValidationError(Context *c,
85 const QVariant &errorData = QVariant()) const override;
86
90 QString genericValidationDataError(Context *c,
91 const QVariant &errorData = QVariant()) const override;
92
93private:
94 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
95 Q_DECLARE_PRIVATE(ValidatorCharNotAllowed)
96 Q_DISABLE_COPY(ValidatorCharNotAllowed)
97};
98
99} // namespace Cutelyst
100
101#endif // CUTELYSTVALIDATORCHARNOTALLOWED_H
The Cutelyst Context.
Definition context.h:42
Validates an input field for not allowed characters.
Base class for all validator rules.
QMultiMap< QString, QString > ParamsMultiMap
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.