Cutelyst
2.14.2
Cutelyst
Plugins
Utils
Validator
validatorresult.h
1
/*
2
* Copyright (C) 2017-2018 Matthias Fehring <kontakt@buschmann23.de>
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
#ifndef CUTELYSTVALIDATORRESULT_H
19
#define CUTELYSTVALIDATORRESULT_H
20
21
#include <Cutelyst/cutelyst_global.h>
22
#include <QString>
23
#include <QStringList>
24
#include <QSharedDataPointer>
25
#include <QVariantHash>
26
#include <QJsonObject>
27
28
namespace
Cutelyst
{
29
30
class
ValidatorResultPrivate;
31
81
class
CUTELYST_PLUGIN_UTILS_VALIDATOR_EXPORT
ValidatorResult
{
82
public
:
89
ValidatorResult
();
90
94
ValidatorResult
(
const
ValidatorResult
&other);
95
99
ValidatorResult
& operator =(
const
ValidatorResult
&other);
100
104
~
ValidatorResult
();
105
111
bool
isValid()
const
;
112
119
void
addError(
const
QString
&field,
const
QString
&message);
120
125
QStringList
errorStrings()
const
;
126
132
QHash<QString,QStringList>
errors()
const
;
133
141
QStringList
errors
(
const
QString
&field)
const
;
142
150
bool
hasErrors(
const
QString
&field)
const
;
151
162
QJsonObject
errorsJsonObject()
const
;
163
169
QStringList
failedFields()
const
;
170
176
explicit
operator
bool()
const
{
177
return
isValid();
178
}
179
188
QVariantHash values()
const
;
189
199
QVariant
value(
const
QString
&field)
const
;
200
208
void
addValue(
const
QString
&field,
const
QVariant
&value);
209
218
QVariantHash extras()
const
;
219
229
QVariant
extra(
const
QString
&field)
const
;
230
238
void
addExtra(
const
QString
&field,
const
QVariant
&extra);
239
240
private
:
241
QSharedDataPointer<ValidatorResultPrivate>
d;
242
};
243
244
}
245
246
#endif // CUTELYSTVALIDATORRESULT_H
QSharedDataPointer< ValidatorResultPrivate >
QString
QJsonObject
Cutelyst::ValidatorResult::errors
QStringList errors(const QString &field) const
Returns a list of all error messages for an input field.
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition:
Mainpage.dox:8
QVariant
QHash
QStringList
Cutelyst::ValidatorResult
Provides information about performed validations.
Definition:
validatorresult.h:81
Generated by
1.8.20