|
17 | 17 | ***************************************************************************/
|
18 | 18 |
|
19 | 19 |
|
20 |
| -%MappedType QPair<QByteArray, QByteArray> |
21 |
| -{ |
22 |
| -%TypeHeaderCode |
23 |
| -#include <QPair> |
24 |
| -#include <QByteArray> |
25 |
| -%End |
26 |
| - |
27 |
| - |
28 |
| -%TypeCode |
29 |
| -// Convenience function for converting a QByteArray to a Python str object. (from QtCore/qbytearray.sip) |
30 |
| -static PyObject *QByteArrayToPyStr(QByteArray *ba) |
31 |
| -{ |
32 |
| - char *data = ba->data(); |
33 |
| - |
34 |
| - if (data) |
35 |
| - // QByteArrays may have embedded '\0's so set the size explicitly. |
36 |
| - return SIPBytes_FromStringAndSize(data, ba->size()); |
37 |
| - return SIPBytes_FromString(""); |
38 |
| -} |
39 |
| - |
40 |
| -%End |
41 |
| - |
42 |
| - |
43 |
| -%ConvertFromTypeCode |
44 |
| - // Create the tuple. |
45 |
| - return Py_BuildValue((char *)"OO", QByteArrayToPyStr( &sipCpp->first ), QByteArrayToPyStr( &sipCpp->second ) ); |
46 |
| -%End |
47 |
| - |
48 |
| -%ConvertToTypeCode |
49 |
| - |
50 |
| -// See if we are just being asked to check the type of the Python |
51 |
| -// object. |
52 |
| -if (!sipIsErr) |
53 |
| -{ |
54 |
| - // Checking whether or not None has been passed instead of a list |
55 |
| - // has already been done. |
56 |
| - if (!PyTuple_Check(sipPy) || PyTuple_Size(sipPy) != 2) |
57 |
| - return 0; |
58 |
| - |
59 |
| - // Check the type of each element. We specify SIP_NOT_NONE to |
60 |
| - // disallow None because it is a list of QPoint, not of a pointer |
61 |
| - // to a QPoint, so None isn't appropriate. |
62 |
| - for (int i = 0; i < PyTuple_Size(sipPy); ++i) |
63 |
| - if (!sipCanConvertToType(PyTuple_GET_ITEM(sipPy, i), |
64 |
| - sipType_QByteArray, SIP_NOT_NONE)) |
65 |
| - return 0; |
66 |
| - |
67 |
| - // The type is valid. |
68 |
| - return 1; |
69 |
| -} |
70 |
| - |
71 |
| -// Create the instance on the heap. |
72 |
| -QPair<QByteArray, QByteArray> *qp = new QPair<QByteArray, QByteArray>; |
73 |
| - |
74 |
| -QByteArray *qba1; |
75 |
| -int state; |
76 |
| - |
77 |
| -// Get the address of the element's C++ instance. Note that, in |
78 |
| -// this case, we don't apply any ownership changes to the list |
79 |
| -// elements, only to the list itself. |
80 |
| -qba1 = reinterpret_cast<QByteArray *>(sipConvertToType( |
81 |
| - PyTuple_GET_ITEM(sipPy, 0), |
82 |
| - sipType_QByteArray, 0, |
83 |
| - SIP_NOT_NONE, |
84 |
| - &state, sipIsErr)); |
85 |
| - |
86 |
| -// Deal with any errors. |
87 |
| -if (*sipIsErr) |
88 |
| -{ |
89 |
| - sipReleaseType(qba1, sipType_QByteArray, state); |
90 |
| - |
91 |
| - // Tidy up. |
92 |
| - delete qp; |
93 |
| - |
94 |
| - // There is no temporary instance. |
95 |
| - return 0; |
96 |
| -} |
97 |
| - |
98 |
| -qp->first = *qba1; |
99 |
| - |
100 |
| -// A copy of the QByteArray was assigned to the pair so we no longer |
101 |
| -// need it. It may be a temporary instance that should be |
102 |
| -// destroyed, or a wrapped instance that should not be destroyed. |
103 |
| -// sipReleaseType() will do the right thing. |
104 |
| -sipReleaseType(qba1, sipType_QByteArray, state); |
105 |
| - |
106 |
| -///////////////////////////////////////////// |
107 |
| -// Second item |
108 |
| - |
109 |
| -QByteArray *qba2; |
110 |
| - |
111 |
| -// Get the address of the element's C++ instance. Note that, in |
112 |
| -// this case, we don't apply any ownership changes to the list |
113 |
| -// elements, only to the list itself. |
114 |
| -qba2 = reinterpret_cast<QByteArray *>(sipConvertToType( |
115 |
| - PyTuple_GET_ITEM(sipPy, 1), |
116 |
| - sipType_QByteArray, 0, |
117 |
| - SIP_NOT_NONE, |
118 |
| - &state, sipIsErr)); |
119 |
| - |
120 |
| -// Deal with any errors. |
121 |
| -if (*sipIsErr) |
122 |
| -{ |
123 |
| - sipReleaseType(qba1, sipType_QByteArray, state); |
124 |
| - sipReleaseType(qba2, sipType_QByteArray, state); |
125 |
| - |
126 |
| - // Tidy up. |
127 |
| - delete qp; |
128 |
| - |
129 |
| - // There is no temporary instance. |
130 |
| - return 0; |
131 |
| -} |
132 |
| - |
133 |
| -qp->second = *qba2; |
134 |
| - |
135 |
| - |
136 |
| -// A copy of the QByteArray was assigned to the pair so we no longer |
137 |
| -// need it. It may be a temporary instance that should be |
138 |
| -// destroyed, or a wrapped instance that should not be destroyed. |
139 |
| -// sipReleaseType() will do the right thing. |
140 |
| -sipReleaseType(qba2, sipType_QByteArray, state); |
141 |
| - |
142 |
| - |
143 |
| -// Return the instance. |
144 |
| -*sipCppPtr = qp; |
145 |
| - |
146 |
| -// The instance should be regarded as temporary (and be destroyed as |
147 |
| -// soon as it has been used) unless it has been transferred from |
148 |
| -// Python. sipGetState() is a convenience function that implements |
149 |
| -// this common transfer behavior. |
150 |
| -return sipGetState(sipTransferObj); |
151 |
| - |
152 |
| -%End |
153 |
| -}; |
154 |
| - |
155 | 20 | /** \ingroup server
|
156 | 21 | * The QgsServer class provides OGC web services.
|
157 | 22 | */
|
@@ -185,18 +50,6 @@ class QgsServer
|
185 | 50 | */
|
186 | 51 | void handleRequest( QgsServerRequest &request, QgsServerResponse &response );
|
187 | 52 |
|
188 |
| - /** Handles the request from query string |
189 |
| - * The query string is normally read from environment |
190 |
| - * but can be also passed in args and in this case overrides the environment |
191 |
| - * variable. |
192 |
| - * |
193 |
| - * \param urlstr QString containing the request url (simple quely string must be preceded by '?') |
194 |
| - * \param requestMethod QgsServerRequest::Method that indicates the method. Only "GET" or "POST" are supported. |
195 |
| - * \param data array of bytes containing post data |
196 |
| - * \param map of request headers |
197 |
| - * \returns the response headers and body QPair of QByteArray |
198 |
| - */ |
199 |
| - QPair<QByteArray, QByteArray> handleRequest( const QString &urlstr, const QgsServerRequest::Method requestMethod = QgsServerRequest::GetMethod, const QgsServerRequest::Headers &headers = QgsServerRequest::Headers(), const char *data = nullptr ); |
200 | 53 |
|
201 | 54 | /** Returns a pointer to the server interface */
|
202 | 55 | QgsServerInterface *serverInterface();
|
|
0 commit comments