Cutelyst  3.5.0
validatorrequiredwithout.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORREQUIREDWITHOUT_H
6 #define CUTELYSTVALIDATORREQUIREDWITHOUT_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include "validatorrule.h"
10 #include <QStringList>
11 
12 namespace Cutelyst {
13 
14 class ValidatorRequiredWithoutPrivate;
15 
32 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorRequiredWithout : public ValidatorRule
33 {
34 public:
41  ValidatorRequiredWithout(const QString &field, const QStringList &otherFields, const ValidatorMessages &messages = ValidatorMessages());
42 
46  ~ValidatorRequiredWithout() 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(ValidatorRequiredWithout)
64  Q_DISABLE_COPY(ValidatorRequiredWithout)
65 };
66 
67 }
68 
69 #endif //CUTELYSTVALIDATORREQUIREDWITHOUT_H
70 
Stores custom error messages and the input field label.
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.
The field under validation must be present and not empty only when any of the other specified fields ...
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49