QGIS API Documentation 3.41.0-Master (64d82d4c163)
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
86 QList<int> toIntList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
87
95 QList<double> toDoubleList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
96
104 QList<QColor> toColorList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
105
113 QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',', bool skipEmptyParts = true ) const;
114
120 QStringList toOgcFilterList() const;
121
127 QStringList toExpressionList() const;
128
134 QgsRectangle toRectangle( bool &ok ) const;
135
141 int toInt( bool &ok ) const;
142
148 double toDouble( bool &ok ) const;
149
154 bool toBool() const;
155
161 QColor toColor( bool &ok ) const;
162
169 QUrl toUrl( bool &ok ) const;
170
177 QString loadUrl( bool &ok ) const;
178
184 static void raiseError( const QString &msg );
185
186 QMetaType::Type mType;
187 QVariant mValue;
189};
190
198{
199 Q_GADGET
200
201 public:
203 enum Name
204 {
207 VERSION_SERVICE, // conflict with #define VERSION
210 FILE_NAME
211 };
212 Q_ENUM( Name )
213
214
220 QgsServerParameter( const QgsServerParameter::Name name = QgsServerParameter::UNKNOWN, const QMetaType::Type type = QMetaType::Type::QString, const QVariant defaultValue = QVariant( "" ) );
221
229 Q_DECL_DEPRECATED QgsServerParameter( const QgsServerParameter::Name name, const QVariant::Type type, const QVariant defaultValue = QVariant( "" ) ) SIP_DEPRECATED;
230
235 void raiseError() const;
236
240 static QString name( const QgsServerParameter::Name name );
241
246 static QgsServerParameter::Name name( const QString &name );
247
249};
250
257class SERVER_EXPORT QgsServerParameters
258{
259 Q_GADGET
260
261 public:
266
270 QgsServerParameters( const QUrlQuery &query );
271
272 virtual ~QgsServerParameters() = default;
273
278 void load( const QUrlQuery &query );
279
283 void clear();
284
290 void add( const QString &key, const QString &value );
291
296 void remove( const QString &key );
297
303 void remove( QgsServerParameter::Name name );
304
309 QString value( const QString &key ) const;
310
314 QUrlQuery urlQuery() const;
315
319 QMap<QString, QString> toMap() const;
320
326 QString service() const;
327
333 virtual QString request() const;
334
340 QString map() const;
341
347 QString fileName() const;
348
354 virtual QString version() const;
355
356 protected:
361 virtual bool loadParameter( const QString &name, const QString &value );
362
363 QMap<QString, QString> mUnmanagedParameters;
364
365 private:
366 void save( const QgsServerParameter &parameter );
367 QVariant value( QgsServerParameter::Name name ) const;
368
369 QMap<QgsServerParameter::Name, QgsServerParameter> mParameters;
370 QUrlQuery mUrlQuery;
371};
372
373#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