cutelyst 4.3.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
40class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorCharNotAllowed : public ValidatorRule
41{
42public:
53 const QString &forbiddenChars,
54 const ValidatorMessages &messages = ValidatorMessages(),
55 const QString &defValKey = QString());
56
61
71 static bool
72 validate(const QString &value, const QString &forbiddenChars, QChar *foundChar = nullptr);
73
74protected:
81 ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
82
86 QString genericValidationError(Context *c,
87 const QVariant &errorData = QVariant()) const override;
88
92 QString genericValidationDataError(Context *c,
93 const QVariant &errorData = QVariant()) const override;
94
95private:
96 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
97 Q_DECLARE_PRIVATE(ValidatorCharNotAllowed)
98 Q_DISABLE_COPY(ValidatorCharNotAllowed)
99};
100
101} // namespace Cutelyst
102
103#endif // CUTELYSTVALIDATORCHARNOTALLOWED_H
The Cutelyst Context.
Definition context.h:42
Validates an input field for not allowed characters.
Base class for all validator rules.
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.