QGIS API Documentation 3.39.0-Master (3aed037ce22)
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 virtual ~QgsServerParameterDefinition() = default;
57
61 QString typeName() const;
62
66 virtual bool isValid() const;
67
72 QString toString( bool defaultValue = false ) const;
73
80 QStringList toStringList( char delimiter = ',', bool skipEmptyParts = true ) const;
81
88 QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
89
96 QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
97
104 QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
105
112 QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
113
119 QStringList toOgcFilterList() const;
120
126 QStringList toExpressionList() const;
127
133 QgsRectangle toRectangle( bool &ok ) const;
134
140 int toInt( bool &ok ) const;
141
147 double toDouble( bool &ok ) const;
148
153 bool toBool() const;
154
160 QColor toColor( bool &ok ) const;
161
168 QUrl toUrl( bool &ok ) const;
169
176 QString loadUrl( bool &ok ) const;
177
183 static void raiseError( const QString &msg );
184
185 QMetaType::Type mType;
186 QVariant mValue;
188};
189
197{
198 Q_GADGET
199
200 public:
202 enum Name
203 {
206 VERSION_SERVICE, // conflict with #define VERSION
209 FILE_NAME
210 };
211 Q_ENUM( Name )
212
213
220 const QMetaType::Type type = QMetaType::Type::QString,
221 const QVariant defaultValue = QVariant( "" ) );
222
230 Q_DECL_DEPRECATED QgsServerParameter( const QgsServerParameter::Name name,
231 const QVariant::Type type,
232 const QVariant defaultValue = QVariant( "" ) ) SIP_DEPRECATED;
233
238 void raiseError() const;
239
243 static QString name( const QgsServerParameter::Name name );
244
249 static QgsServerParameter::Name name( const QString &name );
250
252};
253
260class SERVER_EXPORT QgsServerParameters
261{
262 Q_GADGET
263
264 public:
265
270
274 QgsServerParameters( const QUrlQuery &query );
275
276 virtual ~QgsServerParameters() = default;
277
282 void load( const QUrlQuery &query );
283
287 void clear();
288
294 void add( const QString &key, const QString &value );
295
300 void remove( const QString &key );
301
307 void remove( QgsServerParameter::Name name );
308
313 QString value( const QString &key ) const;
314
318 QUrlQuery urlQuery() const;
319
323 QMap<QString, QString> toMap() const;
324
330 QString service() const;
331
337 virtual QString request() const;
338
344 QString map() const;
345
351 QString fileName() const;
352
358 virtual QString version() const;
359
360 protected:
361
366 virtual bool loadParameter( const QString &name, const QString &value );
367
368 QMap<QString, QString> mUnmanagedParameters;
369
370 private:
371 void save( const QgsServerParameter &parameter );
372 QVariant value( QgsServerParameter::Name name ) const;
373
374 QMap<QgsServerParameter::Name, QgsServerParameter> mParameters;
375 QUrlQuery mUrlQuery;
376};
377
378#endif
A rectangle specified with double values.
Definition of a parameter with basic conversion methods.
virtual ~QgsServerParameterDefinition()=default
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