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