cutelyst  5.0.1
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-2025 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 namespace Cutelyst {
11 
12 class ValidatorDifferentPrivate;
13 
36 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDifferent : public ValidatorRule
37 {
38 public:
48  ValidatorDifferent(const QString &field,
49  const QString &other,
50  const char *otherLabel = nullptr,
51  const ValidatorMessages &messages = ValidatorMessages());
52 
56  ~ValidatorDifferent() override;
57 
58 protected:
65  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
66 
76  void validateCb(Context *c, const ParamsMultiMap &params, ValidatorRtFn cb) const override;
77 
81  QString genericValidationError(Context *c,
82  const QVariant &errorData = QVariant()) const override;
83 
84 private:
85  Q_DECLARE_PRIVATE(ValidatorDifferent) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
86  Q_DISABLE_COPY(ValidatorDifferent)
87 };
88 
89 } // namespace Cutelyst
90 
91 #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.
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