cutelyst
4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
Stores custom error messages and the input field label. More...
#include <Cutelyst/Plugins/Utils/ValidatorRule>
Public Member Functions | |
ValidatorMessages ()=default | |
ValidatorMessages (const char *customLabel, const char *customValidationError=nullptr, const char *customParsingError=nullptr, const char *customValidationDataError=nullptr) | |
Constructs a new ValidatorMessages object with the given parameters. More... | |
Public Attributes | |
const char * | label |
const char * | parsingError |
const char * | validationDataError |
const char * | validationError |
This struct is used by ValidatorRule derived classes to store custom error messages that are also translatable. To make the messages translatable, use QT_TRANSLATE_NOOP() or QT_TRID_NOOP() so that the message can be dynamically translated by the current Context either via Context::translate() or Context::qtTrId(). If you want to omit a custom message, simply use a nullptr
for it. For custom messages that are not set, the ValidatorRule class will return a generic message that will also be translated if Cutelyst has a translation file for the current language in the context.
Note that you should not mix id based and non-id based translations, so you should not mix QT_TRID_NOOP and QT_TRANSLATE_NOOP.
If using QT_TRANSLATE_NOOP you have to set the translation context to the constructor of Validator. Id based translations do not use a translation context. So, if you omit the translation context on the constructor of Validator, internally Context::qtTrId() will be used to find the translated string.
Definition at line 142 of file validatorrule.h.
|
default |
Constructs a default ValidatorMessages object with all custom messages disabled.
|
inline |
customLabel | User visible label for the input field. Should be the same as used on the frontend visible to the user. Will be used by generic error messages if set. |
customValidationError | Custom error message if the validation fails. |
customParsingError | Custom error message if the input value could not be parsed. |
customValidationDataError | Custom error message if validation data is missing or invalid. |
Definition at line 158 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::label |
Field label used for generating generic error messages.
Definition at line 168 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::parsingError |
Custom parsing error message.
Definition at line 170 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::validationDataError |
Custom validation data error message.
Definition at line 171 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::validationError |
Custom validation error messages.
Definition at line 169 of file validatorrule.h.