QGIS API Documentation 3.41.0-Master (57ec4277f5e)
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:
42 QgsServerParameterDefinition( const QMetaType::Type type = QMetaType::Type::QString, const QVariant defaultValue = QVariant( "" ) );
43
44
51 Q_DECL_DEPRECATED QgsServerParameterDefinition( const QVariant::Type type, const QVariant defaultValue = QVariant( "" ) ) SIP_DEPRECATED;
52
53 virtual ~QgsServerParameterDefinition() = default;
54
58 QString typeName() const;
59
63 virtual bool isValid() const;
64
69 QString toString( bool defaultValue = false ) const;
70
77 QStringList toStringList( char delimiter = ',', bool skipEmptyParts = true ) const;
78
85 QList<int> toIntList( bool &ok, char delimiter = ',' ) const;
86
93 QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const;
94
101 QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const;
102
109 QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const;
110
116 QStringList toOgcFilterList() const;
117
123 QStringList toExpressionList() const;
124
130 QgsRectangle toRectangle( bool &ok ) const;
131
137 int toInt( bool &ok ) const;
138
144 double toDouble( bool &ok ) const;
145
150 bool toBool() const;
151
157 QColor toColor( bool &ok ) const;
158
165 QUrl toUrl( bool &ok ) const;
166
173 QString loadUrl( bool &ok ) const;
174
180 static void raiseError( const QString &msg );
181
182 QMetaType::Type mType;
183 QVariant mValue;
185};
186
194{
195 Q_GADGET
196
197 public:
199 enum Name
200 {
203 VERSION_SERVICE, // conflict with #define VERSION
206 FILE_NAME
207 };
208 Q_ENUM( Name )
209
210
216 QgsServerParameter( const QgsServerParameter::Name name = QgsServerParameter::UNKNOWN, const QMetaType::Type type = QMetaType::Type::QString, const QVariant defaultValue = QVariant( "" ) );
217
225 Q_DECL_DEPRECATED QgsServerParameter( const QgsServerParameter::Name name, const QVariant::Type type, const QVariant defaultValue = QVariant( "" ) ) SIP_DEPRECATED;
226
231 void raiseError() const;
232
236 static QString name( const QgsServerParameter::Name name );
237
242 static QgsServerParameter::Name name( const QString &name );
243
245};
246
253class SERVER_EXPORT QgsServerParameters
254{
255 Q_GADGET
256
257 public:
262
266 QgsServerParameters( const QUrlQuery &query );
267
268 virtual ~QgsServerParameters() = default;
269
274 void load( const QUrlQuery &query );
275
279 void clear();
280
286 void add( const QString &key, const QString &value );
287
292 void remove( const QString &key );
293
299 void remove( QgsServerParameter::Name name );
300
305 QString value( const QString &key ) const;
306
310 QUrlQuery urlQuery() const;
311
315 QMap<QString, QString> toMap() const;
316
322 QString service() const;
323
329 virtual QString request() const;
330
336 QString map() const;
337
343 QString fileName() const;
344
350 virtual QString version() const;
351
352 protected:
357 virtual bool loadParameter( const QString &name, const QString &value );
358
359 QMap<QString, QString> mUnmanagedParameters;
360
361 private:
362 void save( const QgsServerParameter &parameter );
363 QVariant value( QgsServerParameter::Name name ) const;
364
365 QMap<QgsServerParameter::Name, QgsServerParameter> mParameters;
366 QUrlQuery mUrlQuery;
367};
368
369#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