cutelyst 4.0.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
11#include <Cutelyst/cutelyst_global.h>
12
13namespace Cutelyst {
14
15class ValidatorCharNotAllowedPrivate;
16
37class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorCharNotAllowed : public ValidatorRule
38{
39public:
49 ValidatorCharNotAllowed(const QString &field,
50 const QString &forbiddenChars,
51 const ValidatorMessages &messages = ValidatorMessages(),
52 const QString &defValKey = QString());
53
58
67 static bool
68 validate(const QString &value, const QString &forbiddenChars, QChar *foundChar = nullptr);
69
70protected:
77 ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
78
82 QString genericValidationError(Context *c,
83 const QVariant &errorData = QVariant()) const override;
84
88 QString genericValidationDataError(Context *c,
89 const QVariant &errorData = QVariant()) const override;
90
91private:
92 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
93 Q_DECLARE_PRIVATE(ValidatorCharNotAllowed)
94 Q_DISABLE_COPY(ValidatorCharNotAllowed)
95};
96
97} // namespace Cutelyst
98
99#endif // CUTELYSTVALIDATORCHARNOTALLOWED_H
The Cutelyst Context.
Definition: context.h:38
<Cutelyst/Plugins/Utils/validatorcharnotallowed.h>
~ValidatorCharNotAllowed() override
Deconstructs the char not allowed validator.
Base class for all validator rules.
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49