cutelyst  4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatormax.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2023 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORMAX_H
6 #define CUTELYSTVALIDATORMAX_H
7 
8 #include "validatorrule.h"
9 
10 #include <Cutelyst/cutelyst_global.h>
11 
12 namespace Cutelyst {
13 
14 class ValidatorMaxPrivate;
15 
48 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorMax : public ValidatorRule
49 {
50 public:
62  ValidatorMax(const QString &field,
63  QMetaType::Type type,
64  const QVariant &max,
65  const ValidatorMessages &messages = ValidatorMessages(),
66  const QString &defValKey = QString());
67 
71  ~ValidatorMax() override;
72 
73 protected:
80  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
81 
85  QString genericValidationError(Context *c,
86  const QVariant &errorData = QVariant()) const override;
87 
91  QString genericValidationDataError(Context *c, const QVariant &errorData) const override;
92 
96  QString genericParsingError(Context *c, const QVariant &errorData) const override;
97 
98 private:
99  Q_DECLARE_PRIVATE(ValidatorMax) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
100  Q_DISABLE_COPY(ValidatorMax)
101 };
102 
103 } // namespace Cutelyst
104 
105 #endif // CUTELYSTVALIDATORMAX_H
Stores custom error messages and the input field label.
The Cutelyst Context.
Definition: context.h:42
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
Checks if a value is not bigger or longer than a maximum value.
Definition: validatormax.h:48
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49