cutelyst  5.0.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatornotin.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2025 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORNOTIN_H
6 #define CUTELYSTVALIDATORNOTIN_H
7 
8 #include "validatorrule.h"
9 
10 #include <QStringList>
11 
12 namespace Cutelyst {
13 
14 class ValidatorNotInPrivate;
15 
37 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorNotIn : public ValidatorRule
38 {
39 public:
52  ValidatorNotIn(const QString &field,
53  const QVariant &values,
55  const ValidatorMessages &messages = ValidatorMessages(),
56  const QString &defValKey = {});
57 
61  ~ValidatorNotIn() override;
62 
63 protected:
70  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
71 
81  void validateCb(Context *c, const ParamsMultiMap &params, ValidatorRtFn cb) const override;
82 
86  QString genericValidationError(Context *c,
87  const QVariant &errorData = QVariant()) const override;
88 
92  QString genericValidationDataError(Context *c, const QVariant &errorData) const override;
93 
94 private:
95  Q_DECLARE_PRIVATE(ValidatorNotIn) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
96  Q_DISABLE_COPY(ValidatorNotIn)
97 };
98 
99 } // namespace Cutelyst
100 
101 #endif // CUTELYSTVALIDATORNOTIN_H
Stores custom error messages and the input field label.
The Cutelyst Context.
Definition: context.h:42
CaseSensitivity
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
std::function< void(ValidatorReturnType &&result)> ValidatorRtFn
Void callback function for validator rules that processes the ValidatorReturnType.
Definition: validatorrule.h:82
Contains the result of a single input parameter validation.
Definition: validatorrule.h:52
Checks if the field value is not one from a list of values.