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