cutelyst  3.9.1
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 "validatorrule.h"
10 
11 #include <Cutelyst/cutelyst_global.h>
12 
13 namespace Cutelyst {
14 
15 class ValidatorCharNotAllowedPrivate;
16 
37 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorCharNotAllowed : public ValidatorRule
38 {
39 public:
49  ValidatorCharNotAllowed(const QString &field,
50  const QString &forbiddenChars,
51  const ValidatorMessages &messages = ValidatorMessages(),
52  const QString &defValKey = QString());
53 
57  ~ValidatorCharNotAllowed() override;
58 
67  static bool
68  validate(const QString &value, const QString &forbiddenChars, QChar *foundChar = nullptr);
69 
70 protected:
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 
91 private:
92  Q_DECLARE_PRIVATE(ValidatorCharNotAllowed)
93  Q_DISABLE_COPY(ValidatorCharNotAllowed)
94 };
95 
96 } // namespace Cutelyst
97 
98 #endif // CUTELYSTVALIDATORCHARNOTALLOWED_H
Stores custom error messages and the input field label.
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
Base class for all validator rules.
<Cutelyst/Plugins/Utils/validatorcharnotallowed.h>
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49