Cutelyst  3.5.0
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 
Stores custom error messages and the input field label.
The field under validation must be present and not empty unless the other field is equal to any value...
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