cutelyst  4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatordigitsbetween.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2023 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORDIGITSBETWEEN_H
6 #define CUTELYSTVALIDATORDIGITSBETWEEN_H
7 
8 #include "validatorrule.h"
9 
10 #include <Cutelyst/cutelyst_global.h>
11 
12 namespace Cutelyst {
13 
14 class ValidatorDigitsBetweenPrivate;
15 
39 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDigitsBetween : public ValidatorRule
40 {
41 public:
56  ValidatorDigitsBetween(const QString &field,
57  const QVariant &min,
58  const QVariant &max,
59  const ValidatorMessages &messages = ValidatorMessages(),
60  const QString &defValKey = QString());
61 
65  ~ValidatorDigitsBetween() override;
66 
80  static bool validate(const QString &value, int min, int max);
81 
82 protected:
89  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
90 
94  QString genericValidationError(Context *c,
95  const QVariant &errorData = QVariant()) const override;
96 
97 private:
98  Q_DECLARE_PRIVATE(ValidatorDigitsBetween) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
99  Q_DISABLE_COPY(ValidatorDigitsBetween)
100 };
101 
102 } // namespace Cutelyst
103 
104 #endif // CUTELYSTVALIDATORDIGITSBETWEEN_H
Stores custom error messages and the input field label.
The Cutelyst Context.
Definition: context.h:42
Checks for digits only with a length between min and max.
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