QGIS API Documentation
3.28.0-Firenze (ed3ad0430f)
src
server
qgsserverquerystringparameter.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsserverquerystringparameter.h - QgsServerQueryStringParameter
3
4
---------------------
5
begin : 10.7.2019
6
copyright : (C) 2019 by Alessandro Pasotti
7
email : elpaso at itopen dot it
8
***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
#ifndef QGSSERVERQUERYSTRINGPARAMETER_H
17
#define QGSSERVERQUERYSTRINGPARAMETER_H
18
19
#include "
qgsserverapicontext.h
"
20
#include "qgis_server.h"
21
#include "
qgis_sip.h
"
22
#include <QString>
23
#include <QVariant>
24
#include <QObject>
25
26
27
#include "nlohmann/json_fwd.hpp"
28
29
#ifndef SIP_RUN
30
using namespace
nlohmann;
31
#endif
32
33
34
class
QgsServerApiBadRequestException
;
35
36
47
class
SERVER_EXPORT
QgsServerQueryStringParameter
48
{
49
50
Q_GADGET
51
52
#ifndef SIP_RUN
53
typedef
std::function< bool (
const
QgsServerApiContext
&, QVariant & ) > customValidator;
54
#endif
55
public
:
56
60
enum class
Type
61
{
62
String = QVariant::String,
63
Integer = QVariant::LongLong,
64
Double = QVariant::Double,
65
Boolean = QVariant::Bool,
66
List = QVariant::StringList,
67
};
68
Q_ENUM( Type )
69
70
71
80
QgsServerQueryStringParameter
(
const
QString name,
81
bool
required =
false
,
82
Type type =
QgsServerQueryStringParameter::Type::String
,
83
const
QString &description = QString(),
84
const
QVariant &defaultValue = QVariant() );
85
86
virtual
~QgsServerQueryStringParameter
();
87
103
virtual
QVariant value(
const
QgsServerApiContext
&context )
const
;
104
105
#ifndef SIP_RUN
106
114
void
setCustomValidator(
const
customValidator &customValidator );
115
119
json data( )
const
;
120
121
#endif
122
126
QString description()
const
;
127
131
static
QString
typeName
(
const
Type type );
132
136
QString name()
const
;
137
141
void
setDescription(
const
QString &description );
142
151
bool
hidden()
const
;
152
158
void
setHidden(
bool
hidden );
159
160
private
:
161
162
QString mName;
163
bool
mRequired =
false
;
164
Type mType = Type::String;
165
customValidator mCustomValidator =
nullptr
;
166
QString mDescription;
167
QVariant mDefaultValue;
168
bool
mHidden =
false
;
169
170
friend
class
TestQgsServerQueryStringParameter;
171
172
};
173
174
#endif
// QGSSERVERQUERYSTRINGPARAMETER_H
QgsServerApiBadRequestException
Bad request error API exception.
Definition:
qgsserverexception.h:233
QgsServerApiContext
The QgsServerApiContext class encapsulates the resources for a particular client request: the request...
Definition:
qgsserverapicontext.h:39
QgsServerQueryStringParameter
The QgsServerQueryStringParameter class holds the information regarding a query string input paramete...
Definition:
qgsserverquerystringparameter.h:48
QgsServerQueryStringParameter::Type
Type
The Type enum represents the parameter type.
Definition:
qgsserverquerystringparameter.h:61
QgsServerQueryStringParameter::Type::String
@ String
qgis_sip.h
qgsserverapicontext.h
typeName
const QString & typeName
Definition:
qgswfsgetfeature.cpp:57
Generated on Sat Oct 22 2022 16:10:47 for QGIS API Documentation by
1.9.4