cutelyst  4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatordifferent.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2023 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORDIFFERENT_H
6 #define CUTELYSTVALIDATORDIFFERENT_H
7 
8 #include "validatorrule.h"
9 
10 #include <Cutelyst/cutelyst_global.h>
11 
12 namespace Cutelyst {
13 
14 class ValidatorDifferentPrivate;
15 
38 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDifferent : public ValidatorRule
39 {
40 public:
50  ValidatorDifferent(const QString &field,
51  const QString &other,
52  const char *otherLabel = nullptr,
53  const ValidatorMessages &messages = ValidatorMessages());
54 
58  ~ValidatorDifferent() override;
59 
60 protected:
67  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
68 
72  QString genericValidationError(Context *c,
73  const QVariant &errorData = QVariant()) const override;
74 
75 private:
76  Q_DECLARE_PRIVATE(ValidatorDifferent) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
77  Q_DISABLE_COPY(ValidatorDifferent)
78 };
79 
80 } // namespace Cutelyst
81 
82 #endif // CUTELYSTVALIDATORDIFFERENT_H
Stores custom error messages and the input field label.
Checks if two values are different.
The Cutelyst Context.
Definition: context.h:42
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49