cutelyst  3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatorsize.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORSIZE_H
6 #define CUTELYSTVALIDATORSIZE_H
7 
8 #include "validatorrule.h"
9 
10 #include <Cutelyst/cutelyst_global.h>
11 
12 namespace Cutelyst {
13 
14 class ValidatorSizePrivate;
15 
47 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorSize : public ValidatorRule
48 {
49 public:
59  ValidatorSize(const QString &field,
60  QMetaType::Type type,
61  const QVariant &size,
62  const ValidatorMessages &messages = ValidatorMessages(),
63  const QString &defValKey = QString());
64 
68  ~ValidatorSize() override;
69 
70 protected:
77  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
78 
82  QString genericValidationError(Context *c,
83  const QVariant &errorData = QVariant()) const override;
84 
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(ValidatorSize)
100  Q_DISABLE_COPY(ValidatorSize)
101 };
102 
103 } // namespace Cutelyst
104 
105 #endif // CUTELYSTVALIDATORSIZE_H
Stores custom error messages and the input field label.
The field under validation must have a size matching the given value.
Definition: validatorsize.h:47
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
Base class for all validator rules.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49