cutelyst  4.5.1
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 namespace Cutelyst {
11 
12 class ValidatorMaxPrivate;
13 
46 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorMax : public ValidatorRule
47 {
48 public:
60  ValidatorMax(const QString &field,
61  QMetaType::Type type,
62  const QVariant &max,
63  const ValidatorMessages &messages = ValidatorMessages(),
64  const QString &defValKey = QString());
65 
69  ~ValidatorMax() override;
70 
71 protected:
78  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
79 
83  QString genericValidationError(Context *c,
84  const QVariant &errorData = QVariant()) const override;
85 
89  QString genericValidationDataError(Context *c, const QVariant &errorData) const override;
90 
94  QString genericParsingError(Context *c, const QVariant &errorData) const override;
95 
96 private:
97  Q_DECLARE_PRIVATE(ValidatorMax) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
98  Q_DISABLE_COPY(ValidatorMax)
99 };
100 
101 } // namespace Cutelyst
102 
103 #endif // CUTELYSTVALIDATORMAX_H
The Cutelyst Context.
Definition: context.h:42
Checks if a value is not bigger or longer than a maximum value.
Definition: validatormax.h:47
Base class for all validator rules.
The Cutelyst namespace holds all public Cutelyst API.
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49