cutelyst  3.7.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatorpresent.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORPRESENT_H
6 #define CUTELYSTVALIDATORPRESENT_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include "validatorrule.h"
10 
11 namespace Cutelyst {
12 
13 class ValidatorPresentPrivate;
14 
27 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorPresent : public ValidatorRule
28 {
29 public:
35  ValidatorPresent(const QString &field, const ValidatorMessages &messages = ValidatorMessages());
36 
40  ~ValidatorPresent() override;
41 
42 protected:
49  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
50 
54  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
55 
56 private:
57  Q_DECLARE_PRIVATE(ValidatorPresent)
58  Q_DISABLE_COPY(ValidatorPresent)
59 };
60 
61 }
62 
63 #endif //CUTELYSTVALIDATORPRESENT_H
64 
The Cutelyst Context.
Definition: context.h:39
The field under validation must be present in input data but can be empty.
Base class for all validator rules.
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49