cutelyst  4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
validatoralphanum.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2023 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORALPHANUM_H
6 #define CUTELYSTVALIDATORALPHANUM_H
7 
8 #include "validatorrule.h"
9 
10 #include <Cutelyst/cutelyst_global.h>
11 
12 namespace Cutelyst {
13 
14 class ValidatorAlphaNumPrivate;
15 
46 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorAlphaNum : public ValidatorRule
47 {
48 public:
58  ValidatorAlphaNum(const QString &field,
59  bool asciiOnly = false,
60  const ValidatorMessages &messages = ValidatorMessages(),
61  const QString &defValKey = QString());
62 
66  ~ValidatorAlphaNum() override;
67 
75  static bool validate(const QString &value, bool asciiOnly = false);
76 
77 protected:
84  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
85 
89  QString genericValidationError(Context *c,
90  const QVariant &errorData = QVariant()) const override;
91 
92 private:
93  Q_DECLARE_PRIVATE(ValidatorAlphaNum) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
94  Q_DISABLE_COPY(ValidatorAlphaNum)
95 };
96 
97 } // namespace Cutelyst
98 
99 #endif // CUTELYSTVALIDATORALPHANUM_H
Stores custom error messages and the input field label.
The Cutelyst Context.
Definition: context.h:42
Checks a value for only alpha-numeric content.
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