cutelyst  3.7.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatorrequiredunless.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORREQUIREDUNLESS_H
6 #define CUTELYSTVALIDATORREQUIREDUNLESS_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include "validatorrule.h"
10 
11 namespace Cutelyst {
12 
13 class ValidatorRequiredUnlessPrivate;
14 
31 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorRequiredUnless : public ValidatorRule
32 {
33 public:
41  ValidatorRequiredUnless(const QString &field, const QString &otherField, const QStringList &otherValues, const ValidatorMessages &messages = ValidatorMessages());
42 
46  ~ValidatorRequiredUnless() override;
47 
48 protected:
55  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
56 
60  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
61 
62 private:
63  Q_DECLARE_PRIVATE(ValidatorRequiredUnless)
64  Q_DISABLE_COPY(ValidatorRequiredUnless)
65 };
66 
67 }
68 
69 #endif //CUTELYSTVALIDATORREQUIREDUNLESS_H
70 
The Cutelyst Context.
Definition: context.h:39
The field under validation must be present and not empty unless the other field is equal to any value...
Base class for all validator rules.
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49