Cutelyst  3.5.0
validatorrequiredunlessstash.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2018-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef CUTELYSTVALIDATORREQUIREDUNLESSSTASH_H
7 #define CUTELYSTVALIDATORREQUIREDUNLESSSTASH_H
8 
9 #include "validatorrule.h"
10 #include <Cutelyst/cutelyst_global.h>
11 
12 namespace Cutelyst {
13 
14 class ValidatorRequiredUnlessStashPrivate;
15 
34 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorRequiredUnlessStash : public ValidatorRule
35 {
36 public:
44  ValidatorRequiredUnlessStash(const QString &field, const QString &stashKey, const QVariantList &stashValues, const ValidatorMessages &messages = ValidatorMessages());
45 
49  ~ValidatorRequiredUnlessStash() override;
50 
51 protected:
58  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
59 
63  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
64 
65 private:
66  Q_DECLARE_PRIVATE(ValidatorRequiredUnlessStash)
67  Q_DISABLE_COPY(ValidatorRequiredUnlessStash)
68 };
69 
70 }
71 
72 #endif // CUTELYSTVALIDATORREQUIREDUNLESSSTASH_H
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 emptly unless the content of a stash key is equal ...
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49