Cutelyst  3.5.0
validatorrequiredwith.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORREQUIREDWITH_H
6 #define CUTELYSTVALIDATORREQUIREDWITH_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include "validatorrule.h"
10 #include <QStringList>
11 
12 namespace Cutelyst {
13 
14 class ValidatorRequiredWithPrivate;
15 
16 
33 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorRequiredWith : public ValidatorRule
34 {
35 public:
42  ValidatorRequiredWith(const QString &field, const QStringList &otherFields, const ValidatorMessages &messages = ValidatorMessages());
43 
47  ~ValidatorRequiredWith() override;
48 
49 protected:
56  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
57 
61  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
62 
63 private:
64  Q_DECLARE_PRIVATE(ValidatorRequiredWith)
65  Q_DISABLE_COPY(ValidatorRequiredWith)
66 };
67 
68 }
69 
70 #endif //CUTELYSTVALIDATORREQUIREDWITH_H
71 
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 if any of the other specified fields is...
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49