|
9 | 9 |
|
10 | 10 |
|
11 | 11 |
|
12 |
| -class QgsServerParameters |
| 12 | +class QgsServerParameterDefinition |
13 | 13 | {
|
14 | 14 | %Docstring
|
15 |
| -QgsServerParameters provides an interface to retrieve and manipulate |
16 |
| -global parameters received from the client. |
| 15 | +************************************************************************* |
17 | 16 |
|
18 |
| -.. versionadded:: 3.4 |
| 17 | +This program is free software; you can redistribute it and/or modify * |
| 18 | +it under the terms of the GNU General Public License as published by * |
| 19 | +the Free Software Foundation; either version 2 of the License, or * |
| 20 | +(at your option) any later version. * |
| 21 | + |
| 22 | +************************************************************************** |
19 | 23 | %End
|
20 | 24 |
|
| 25 | +%TypeHeaderCode |
| 26 | +#include "qgsserverparameters.h" |
| 27 | +%End |
| 28 | + public: |
| 29 | + QgsServerParameterDefinition( const QVariant::Type type = QVariant::String, |
| 30 | + const QVariant defaultValue = QVariant( "" ) ); |
| 31 | + |
| 32 | + QString typeName() const; |
| 33 | + virtual bool isValid() const; |
| 34 | + |
| 35 | + QString toString() const; |
| 36 | + QStringList toStringList( char delimiter = ',' ) const; |
| 37 | + QList<int> toIntList( bool &ok, char delimiter = ',' ) const; |
| 38 | + QList<double> toDoubleList( bool &ok, char delimiter = ',' ) const; |
| 39 | + QList<QColor> toColorList( bool &ok, char delimiter = ',' ) const; |
| 40 | + QList<QgsGeometry> toGeomList( bool &ok, char delimiter = ',' ) const; |
| 41 | + QgsRectangle toRectangle( bool &ok ) const; |
| 42 | + int toInt( bool &ok ) const; |
| 43 | + double toDouble( bool &ok ) const; |
| 44 | + bool toBool() const; |
| 45 | + QColor toColor( bool &ok ) const; |
| 46 | + |
| 47 | + static void raiseError( const QString &msg ); |
| 48 | + |
| 49 | + QVariant::Type mType; |
| 50 | + QVariant mValue; |
| 51 | + QVariant mDefaultValue; |
| 52 | +}; |
| 53 | + |
| 54 | +class QgsServerParameter : QgsServerParameterDefinition |
| 55 | +{ |
| 56 | + |
21 | 57 | %TypeHeaderCode
|
22 | 58 | #include "qgsserverparameters.h"
|
23 | 59 | %End
|
24 | 60 | public:
|
25 | 61 | static const QMetaObject staticMetaObject;
|
26 | 62 |
|
27 | 63 | public:
|
28 |
| - enum ParameterName |
| 64 | + enum Name |
29 | 65 | {
|
| 66 | + UNKNOWN, |
30 | 67 | SERVICE,
|
31 | 68 | VERSION_SERVICE,
|
32 | 69 | REQUEST,
|
33 | 70 | MAP,
|
34 | 71 | FILE_NAME
|
35 | 72 | };
|
36 | 73 |
|
37 |
| - struct Parameter |
38 |
| - { |
39 |
| - ParameterName mName; |
40 |
| - QVariant::Type mType; |
41 |
| - QVariant mDefaultValue; |
42 |
| - QVariant mValue; |
43 |
| - bool mDefined; |
44 |
| - }; |
| 74 | + QgsServerParameter( const QgsServerParameter::Name name = QgsServerParameter::UNKNOWN, |
| 75 | + const QVariant::Type type = QVariant::String, |
| 76 | + const QVariant defaultValue = QVariant( "" ) ); |
| 77 | + |
| 78 | + void raiseError() const; |
| 79 | + |
| 80 | + static QString name( const QgsServerParameter::Name name ); |
| 81 | + static QgsServerParameter::Name name( const QString &name ); |
| 82 | + |
| 83 | + QgsServerParameter::Name mName; |
| 84 | +}; |
| 85 | + |
| 86 | +class QgsServerParameters |
| 87 | +{ |
| 88 | +%Docstring |
| 89 | +QgsServerParameters provides an interface to retrieve and manipulate |
| 90 | +global parameters received from the client. |
| 91 | + |
| 92 | +.. versionadded:: 3.4 |
| 93 | +%End |
| 94 | + |
| 95 | +%TypeHeaderCode |
| 96 | +#include "qgsserverparameters.h" |
| 97 | +%End |
| 98 | + public: |
| 99 | + static const QMetaObject staticMetaObject; |
| 100 | + |
| 101 | + public: |
45 | 102 |
|
46 | 103 | QgsServerParameters();
|
47 | 104 | %Docstring
|
@@ -137,6 +194,9 @@ defined.
|
137 | 194 | :return: version
|
138 | 195 | %End
|
139 | 196 |
|
| 197 | + protected: |
| 198 | + virtual bool loadParameter( const QPair<QString, QString> &item ); |
| 199 | + |
140 | 200 | };
|
141 | 201 |
|
142 | 202 | /************************************************************************
|
|
0 commit comments