cutelyst  3.9.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-2022 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 
35 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDifferent : public ValidatorRule
36 {
37 public:
45  ValidatorDifferent(const QString &field,
46  const QString &other,
47  const char *otherLabel = nullptr,
48  const ValidatorMessages &messages = ValidatorMessages());
49 
53  ~ValidatorDifferent() override;
54 
55 protected:
62  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
63 
67  QString genericValidationError(Context *c,
68  const QVariant &errorData = QVariant()) const override;
69 
70 private:
71  Q_DECLARE_PRIVATE(ValidatorDifferent)
72  Q_DISABLE_COPY(ValidatorDifferent)
73 };
74 
75 } // namespace Cutelyst
76 
77 #endif // CUTELYSTVALIDATORDIFFERENT_H
Stores custom error messages and the input field label.
Checks if two values are different.
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.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49