cutelyst  3.7.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-2022 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 <Cutelyst/cutelyst_global.h>
10 #include "validatorrule.h"
11 
12 namespace Cutelyst {
13 
14 class ValidatorCharNotAllowedPrivate;
15 
34 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorCharNotAllowed : public ValidatorRule
35 {
36 public:
45  ValidatorCharNotAllowed(const QString &field, const QString &forbiddenChars, const ValidatorMessages &messages = ValidatorMessages(), const QString &defValKey = QString());
46 
50  ~ValidatorCharNotAllowed() override;
51 
60  static bool validate(const QString &value, const QString &forbiddenChars, QChar *foundChar = nullptr);
61 
62 protected:
69  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
70 
74  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
75 
79  QString genericValidationDataError(Context *c, const QVariant &errorData = QVariant()) const override;
80 
81 private:
82  Q_DECLARE_PRIVATE(ValidatorCharNotAllowed)
83  Q_DISABLE_COPY(ValidatorCharNotAllowed)
84 };
85 
86 }
87 
88 #endif // CUTELYSTVALIDATORCHARNOTALLOWED_H
The Cutelyst Context.
Definition: context.h:39
Validates an input field for not allowed characters.
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