QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
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 "qgis_server.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsserverapicontext.h
"
22
23
#include <QObject>
24
#include <QString>
25
#include <QVariant>
26
27
#ifndef SIP_RUN
28
#include <nlohmann/json.hpp>
29
using namespace
nlohmann;
30
#endif
31
32
33
class
QgsServerApiBadRequestException
;
34
35
46
class
SERVER_EXPORT
QgsServerQueryStringParameter
47
{
48
Q_GADGET
49
50
#ifndef SIP_RUN
51
typedef
std::function<bool(
const
QgsServerApiContext
&, QVariant & )> customValidator;
52
#endif
53
public
:
57
enum class
Type
58
{
59
String = QMetaType::Type::QString,
60
Integer = QMetaType::Type::LongLong,
61
Double = QMetaType::Type::Double,
62
Boolean = QMetaType::Type::Bool,
63
List = QMetaType::Type::QStringList,
64
};
65
Q_ENUM( Type )
66
67
68
77
QgsServerQueryStringParameter
(
78
const
QString name,
bool
required =
false
, Type type =
QgsServerQueryStringParameter::Type::String
,
const
QString &description = QString(),
const
QVariant &defaultValue = QVariant()
79
);
80
81
virtual
~QgsServerQueryStringParameter
();
82
98
virtual
QVariant value(
const
QgsServerApiContext
&context )
const
;
99
100
#ifndef SIP_RUN
101
109
void
setCustomValidator(
const
customValidator &customValidator );
110
114
json data()
const
;
115
116
#endif
117
121
QString description()
const
;
122
126
static
QString typeName(
const
Type type );
127
131
QString name()
const
;
132
136
void
setDescription(
const
QString &description );
137
146
bool
hidden()
const
;
147
153
void
setHidden(
bool
hidden );
154
155
private
:
156
QString mName;
157
bool
mRequired =
false
;
158
Type mType = Type::String;
159
customValidator mCustomValidator =
nullptr
;
160
QString mDescription;
161
QVariant mDefaultValue;
162
bool
mHidden =
false
;
163
164
friend
class
TestQgsServerQueryStringParameter
;
165
};
166
167
#endif
// QGSSERVERQUERYSTRINGPARAMETER_H
QgsServerApiBadRequestException
Bad request error API exception.
Definition
qgsserverexception.h:225
QgsServerApiContext
Encapsulates the resources for a particular client request.
Definition
qgsserverapicontext.h:41
QgsServerQueryStringParameter
Holds the information regarding a query string input parameter and its validation.
Definition
qgsserverquerystringparameter.h:47
QgsServerQueryStringParameter::TestQgsServerQueryStringParameter
friend class TestQgsServerQueryStringParameter
Definition
qgsserverquerystringparameter.h:164
QgsServerQueryStringParameter::QgsServerQueryStringParameter
QgsServerQueryStringParameter(const QString name, bool required=false, Type type=QgsServerQueryStringParameter::Type::String, const QString &description=QString(), const QVariant &defaultValue=QVariant())
Constructs a QgsServerQueryStringParameter object.
Definition
qgsserverquerystringparameter.cpp:30
QgsServerQueryStringParameter::Type
Type
The Type enum represents the parameter type.
Definition
qgsserverquerystringparameter.h:58
QgsServerQueryStringParameter::Type::String
@ String
Parameter is a string.
Definition
qgsserverquerystringparameter.h:59
qgis_sip.h
qgsserverapicontext.h
Generated on
for QGIS API Documentation by
1.17.0