Cutelyst  3.5.0
validatoralphadash.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTVALIDATORALPHADASH_H
6 #define CUTELYSTVALIDATORALPHADASH_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include "validatorrule.h"
10 
11 namespace Cutelyst {
12 
13 class ValidatorAlphaDashPrivate;
14 
41 class CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT ValidatorAlphaDash : public ValidatorRule
42 {
43 public:
51  ValidatorAlphaDash(const QString &field, bool asciiOnly = false, const ValidatorMessages &messages = ValidatorMessages(), const QString &defValKey = QString());
52 
56  ~ValidatorAlphaDash() override;
57 
65  static bool validate(const QString &value, bool asciiOnly = false);
66 
67 protected:
74  ValidatorReturnType validate(Context *c, const ParamsMultiMap &params) const override;
75 
79  QString genericValidationError(Context *c, const QVariant &errorData = QVariant()) const override;
80 
81 private:
82  Q_DECLARE_PRIVATE(ValidatorAlphaDash)
83  Q_DISABLE_COPY(ValidatorAlphaDash)
84 };
85 
86 }
87 
88 #endif //CUTELYSTVALIDATORALPHADASH_H
Stores custom error messages and the input field label.
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.
Checks a value for only alpha-numeric content and dashes and underscores.
Contains the result of a single input parameter validation.
Definition: validatorrule.h:49