QGIS API Documentation 3.37.0-Master (08041ddf763)
Loading...
Searching...
No Matches
qgsserverparameters.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsserverparameters.h
3 ------------------
4 begin : Jun 27, 2018
5 copyright : (C) 2018 by Paul Blottiere
6 email : paul dot blottiere at oslandia dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSERVERPARAMETERS_H
19#define QGSSERVERPARAMETERS_H
20
21#include <QMap>
22#include <QMetaEnum>
23#include <QUrlQuery>
24#include <QColor>
25#include "qgsgeometry.h"
26#include "qgis_server.h"
27
35{
36 public:
37
43 QgsServerParameterDefinition( const QMetaType::Type type = QMetaType::Type::QString,
44 const QVariant defaultValue = QVariant( "" ) );
45
46
53 Q_DECL_DEPRECATED QgsServerParameterDefinition( const QVariant::Type type,
54 const QVariant defaultValue = QVariant( "" ) ) SIP_DEPRECATED;
55
56
60 virtual ~QgsServerParameterDefinition() = default;
61
65 QString typeName() const;
66
70 virtual bool isValid() const;
71
76 QString toString( bool defaultValue = false ) const;
77
84 QStringList toStringList( char delimiter = ',', bool skipEmptyParts = true ) const;
85
92 QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
93
100 QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
101
108 QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
109
116 QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
117
123 QStringList toOgcFilterList() const;
124
130 QStringList toExpressionList() const;
131
137 QgsRectangle toRectangle( bool &ok ) const;
138
144 int toInt( bool &ok ) const;
145
151 double toDouble( bool &ok ) const;
152
157 bool toBool() const;
158
164 QColor toColor( bool &ok ) const;
165
172 QUrl toUrl( bool &ok ) const;
173
180 QString loadUrl( bool &ok ) const;
181
187 static void raiseError( const QString &msg );
188
189 QMetaType::Type mType;
190 QVariant mValue;
192};
193
201{
202 Q_GADGET
203
204 public:
206 enum Name
207 {
210 VERSION_SERVICE, // conflict with #define VERSION
213 FILE_NAME
214 };
215 Q_ENUM( Name )
216
217
224 const QMetaType::Type type = QMetaType::Type::QString,
225 const QVariant defaultValue = QVariant( "" ) );
226
234 Q_DECL_DEPRECATED QgsServerParameter( const QgsServerParameter::Name name,
235 const QVariant::Type type,
236 const QVariant defaultValue = QVariant( "" ) ) SIP_DEPRECATED;
237
242 void raiseError() const;
243
247 static QString name( const QgsServerParameter::Name name );
248
253 static QgsServerParameter::Name name( const QString &name );
254
256};
257
264class SERVER_EXPORT QgsServerParameters
265{
266 Q_GADGET
267
268 public:
269
274
278 QgsServerParameters( const QUrlQuery &query );
279
280 virtual ~QgsServerParameters() = default;
281
286 void load( const QUrlQuery &query );
287
291 void clear();
292
298 void add( const QString &key, const QString &value );
299
304 void remove( const QString &key );
305
311 void remove( QgsServerParameter::Name name );
312
317 QString value( const QString &key ) const;
318
322 QUrlQuery urlQuery() const;
323
327 QMap<QString, QString> toMap() const;
328
334 QString service() const;
335
341 virtual QString request() const;
342
348 QString map() const;
349
355 QString fileName() const;
356
362 virtual QString version() const;
363
364 protected:
365
370 virtual bool loadParameter( const QString &name, const QString &value );
371
372 QMap<QString, QString> mUnmanagedParameters;
373
374 private:
375 void save( const QgsServerParameter &parameter );
376 QVariant value( QgsServerParameter::Name name ) const;
377
378 QMap<QgsServerParameter::Name, QgsServerParameter> mParameters;
379 QUrlQuery mUrlQuery;
380};
381
382#endif
A rectangle specified with double values.
Definition of a parameter with basic conversion methods.
virtual ~QgsServerParameterDefinition()=default
Default destructor for QgsServerParameterDefinition.
Parameter common to all services (WMS, WFS, ...)
Name
Parameter's name common to all services.
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
virtual ~QgsServerParameters()=default
QMap< QString, QString > mUnmanagedParameters
#define SIP_DEPRECATED
Definition qgis_sip.h:106
const QString & typeName