cutelyst 5.0.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-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
10namespace Cutelyst {
11
12class ValidatorDifferentPrivate;
13
36class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDifferent : public ValidatorRule
37{
38public:
48 ValidatorDifferent(const QString &field,
49 const QString &other,
50 const char *otherLabel = nullptr,
51 const ValidatorMessages &messages = ValidatorMessages());
52
57
58protected:
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
84private:
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
The Cutelyst Context.
Definition context.h:42
Checks if two values are different.
Base class for all validator rules.
std::function< void(ValidatorReturnType &&result)> ValidatorRtFn
Void callback function for validator rules that processes the ValidatorReturnType.
The Cutelyst namespace holds all public Cutelyst API.
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.