cutelyst  4.9.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatorbetween.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2023 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORBETWEEN_H
6 #define CUTELYSTVALIDATORBETWEEN_H
7 
8 #include "validatorrule.h"
9 
10 namespace Cutelyst {
11 
12 class ValidatorBetweenPrivate;
50 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorBetween : public ValidatorRule
51 {
52 public:
69  ValidatorBetween(const QString &field,
70  QMetaType::Type type,
71  const QVariant &min,
72  const QVariant &max,
73  const ValidatorMessages &messages = ValidatorMessages(),
74  const QString &defValKey = QString());
75 
79  ~ValidatorBetween() override;
80 
81 protected:
88  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
89 
93  QString genericValidationError(Context *c,
94  const QVariant &errorData = QVariant()) const override;
95 
99  QString genericValidationDataError(Context *c, const QVariant &errorData) const override;
100 
104  QString genericParsingError(Context *c, const QVariant &errorData) const override;
105 
106 private:
107  Q_DECLARE_PRIVATE(ValidatorBetween) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
108  Q_DISABLE_COPY(ValidatorBetween)
109 };
110 
111 } // namespace Cutelyst
112 
113 #endif // CUTELYSTVALIDATORBETWEEN_H
Checks if a value or text length is between a minimum and maximum value.
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.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49