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:
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
85 const QVariant &errorData = QVariant()) const override;
86
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
QString genericValidationDataError(Context *c, const QVariant &errorData=QVariant()) const override
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
ValidatorCharNotAllowed(const QString &field, const QString &forbiddenChars, const ValidatorMessages &messages=ValidatorMessages(), const QString &defValKey=QString())
QString field() const noexcept
ValidatorRule(const QString &field, const ValidatorMessages &messages={}, const QString &defValKey={}, QByteArrayView validatorName=nullptr)
QString value(const ParamsMultiMap &params) const
QMultiMap< QString, QString > ParamsMultiMap
static bool validate(const QString &value, const QString &forbiddenChars, QChar *foundChar=nullptr)
Returns true if value does not contain any of the forbideden characters.
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.