cutelyst  3.7.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatordigits.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORDIGITS_H
6 #define CUTELYSTVALIDATORDIGITS_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include "validatorrule.h"
10 
11 namespace Cutelyst {
12 
13 class ValidatorDigitsPrivate;
14 
34 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorDigits : public ValidatorRule
35 {
36 public:
45  ValidatorDigits(const QString &field, const QVariant &length = -1, const ValidatorMessages &messages = ValidatorMessages(), const QString &defValKey = QString());
46 
50  ~ValidatorDigits() override;
51 
62  static bool validate(const QString &value, int length = -1);
63 
64 protected:
70  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
71 
77  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
78 
79 private:
80  Q_DECLARE_PRIVATE(ValidatorDigits)
81  Q_DISABLE_COPY(ValidatorDigits)
82 };
83 
84 }
85 
86 #endif //CUTELYSTVALIDATORDIGITS_H
87 
The Cutelyst Context.
Definition: context.h:39
Checks for digits only with optional length check.
Base class for all validator rules.
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
Stores custom error messages and the input field label.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49