QGIS API Documentation 4.3.0-Master (0d5b841b09e)
Loading...
Searching...
No Matches
qgis_sip.h
Go to the documentation of this file.
1/***************************************************************************
2 qgis_sip - QGIS SIP Macros
3
4 ---------------------
5 begin : 4.5.2017
6 copyright : (C) 2017 by Denis Rouzaud
7 email : denis.rouzaud@gmail.com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGIS_SIP_H
17#define QGIS_SIP_H
18
19/*
20 * if written, the SIP file will not be generated automatically
21 * or can be also defined directly in the file (to avoid including this)
22 */
23
24/*
25 * the module will be included if the condition is met
26 */
27#define SIP_IF_MODULE( condition )
28
29
30/*
31 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-Transfer
32 *
33 * Example QgsVectorLayer::setDiagramRenderer
34 */
35#define SIP_TRANSFER
36
37
38/*
39 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-GetWrapper
40 *
41 */
42#define SIP_GETWRAPPER
43
44/*
45 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-TransferBack
46 */
47#define SIP_TRANSFERBACK
48
49/*
50 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-TransferThis
51 */
52#define SIP_TRANSFERTHIS
53
54/*
55 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-Out
56 */
57#define SIP_OUT
58
59/*
60 * Alternative to SIP_OUT for methods with manual SIP MethodCode, where only the docstring needs to be
61 * considered for the output argument.
62 *
63 * No /Out/ annotation will be added to the SIP bindings.
64 */
65#define SIP_DOCSTRING_OUT
66
67/*
68 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-In
69 */
70#define SIP_IN
71
72/*
73 * Combination of
74 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-In
75 * and
76 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-Out
77 */
78#define SIP_INOUT
79
80/*
81 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-Factory
82 */
83#define SIP_FACTORY
84
85/*
86 * https://python-sip.readthedocs.io/en/stable/annotations.html#class-annotation-PyName
87 */
88#define SIP_PYNAME( name )
89
90/*
91 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-KeepReference
92 */
93#define SIP_KEEPREFERENCE
94
95/*
96 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-Array
97 */
98#define SIP_ARRAY
99
100/*
101 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-ArraySize
102 */
103#define SIP_ARRAYSIZE
104
105/*
106 * https://python-sip.readthedocs.io/en/stable/annotations.html#class-annotation-NoDefaultCtors
107 */
108#define SIP_NODEFAULTCTORS
109
110/*
111 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-Deprecated
112 */
113#define SIP_DEPRECATED
114
115/*
116 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-Constrained
117 */
118#define SIP_CONSTRAINED
119
120/*
121 * https://python-sip.readthedocs.io/en/stable/annotations.html#class-annotation-External
122 */
123#define SIP_EXTERNAL
124
125/*
126 * https://python-sip.readthedocs.io/en/stable/annotations.html#argument-annotation-AllowNone
127 */
128#define SIP_ALLOWNONE
129
130/*
131 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-DisallowNone
132 */
133#define SIP_DISALLOWNONE
134
135/*
136 * discard line
137 */
138#define SIP_SKIP
139
140/*
141 * force a private line to be written
142 */
143#define SIP_FORCE
144
145/*
146 * change the method access to private
147 */
148#define SIP_MAKE_PRIVATE
149
150/*
151 * specify an alternative type for SIP argument or return value
152 */
153#define SIP_PYALTERNATIVETYPE( type )
154
155/*
156 * specify an alternative default value for SIP argument
157 */
158#define SIP_PYARGDEFAULT( value )
159
160/*
161 * remove argument in SIP method
162 */
163#define SIP_PYARGREMOVE
164
165/*
166 * remove argument in SIP method only for Qt version >= 6
167 */
168#define SIP_PYARGREMOVE6
169
170/*
171 * rename argument in SIP method
172 */
173#define SIP_PYARGRENAME( pyname )
174
175/*
176 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-ReleaseGIL
177 */
178#define SIP_RELEASEGIL
179
180/*
181 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-HoldGIL
182 */
183#define SIP_HOLDGIL
184
185/*
186 * Will insert a `%Feature feature` directive in sip files
187 */
188#define SIP_FEATURE( feature )
189
190/*
191 * Will insert a `%If feature` directive in sip files
192 */
193#define SIP_IF_FEATURE( feature )
194
195/*
196 * Will place the current line with an `%If feature` directive in sip file
197 */
198#define SIP_WHEN_FEATURE( feature )
199
200/*
201 * Convert to subclass code
202 */
203#define SIP_CONVERT_TO_SUBCLASS_CODE( code )
204
205/*
206 * Virtual error handler (/VirtualErrorHandler/)
207 */
208#define SIP_VIRTUALERRORHANDLER( name )
209
210/*
211 * Throw - adds deprecated c++ throw calls for sip. Required for sip to add appropriate
212 * try/catch blocks around call and catch the correct exception, otherwise only
213 * unknown generic exceptions are available for Python code.
214 */
215#define SIP_THROW( name, ... )
216
217/*
218 * Will insert a `%End` directive in sip files
219 */
220#define SIP_END
221
222/*
223 * Class level annotation for abstract classes
224 */
225#define SIP_ABSTRACT
226
227/*
228 * Virtual catcher code
229 */
230#define SIP_VIRTUAL_CATCHER_CODE( code )
231
232/*
233 * Force documentation of templates
234 */
235#define SIP_DOC_TEMPLATE
236
237/*
238 * Specifies the type of the value returned by the function as it will appear in any
239 * generated docstrings and PEP 484 type hints. It is usually used with results of type
240 * SIP_PYOBJECT to provide a more specific type.
241 */
242#define SIP_TYPEHINT( type )
243
244/*
245 * Define Python special method (bool, repr, etc.) using the given method or code
246 * sipify.py will create a dedicated python file named according to the class
247 * and located in python/{module}/auto_additions/{classname}.py
248 * a simple method name can be provided (e.g. isValid) and sipify will create the proper code
249 * or some Python code can be provided:
250 *
251 * SIP_PYTHON_SPECIAL_BOOL( isValid )
252 * => sipify => MyClass.__bool__ = lambda self: self.isValid()
253 *
254 * SIP_PYTHON_SPECIAL_REPR( "'<MyClass {}>'format(self.toString())'" )
255 * => sipify => MyClass.__repr__ = lambda self: '<MyClass {}>'format(self.toString())'
256 */
257#define SIP_PYTHON_SPECIAL_BOOL( method_or_code )
258#define SIP_PYTHON_SPECIAL_REPR( method_or_code )
259
260/*
261 * If one reformat an enum to a scope based enum
262 * sipify will take care of monkey patching to keep
263 * API compatibility.
264 * If OUTSIDE_CLASS is defined, the enum has been unnested
265 * from the class, and it will be used for monkey patching
266 * e.g. QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
267 * These macros should be removed in QGIS 5
268 */
269#define SIP_MONKEYPATCH_SCOPEENUM
270#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST( OUTSIDE_CLASS, FORMERNAME )
271#define SIP_MONKEYPATCH_FLAGS_UNNEST( OUTSIDE_CLASS, FORMERNAME )
272#define SIP_MONKEYPATCH_COMPAT_NAME( FORMERNAME )
273
274/*
275 * Directive to define the base type for a enum
276 */
277#define SIP_ENUM_BASETYPE( type )
278
279/*
280 * Directive to define a Python property;
281 */
282#define SIP_PROPERTY( name, getter, setter )
283
284/*
285 * Directive to indicate that following code is only available with Qt 5 version
286 */
287#define SIP_PYQT5_RUN
288
289/*
290 * Adds an include in the type header code
291 */
292#define SIP_TYPEHEADER_INCLUDE( file )
293
294/*
295 * Inserts sip conversion code for QList<class_name::enum_name>, where class_name::enum_name is a c++ enum.
296 *
297 * Extra arguments can contain extra headers to include in the conversion code.
298 */
299#define SIP_INSERT_QLIST_ENUM_CONVERSION_CODE( class_name, ... )
300
301#define SIP_NO_FILE
302
303#endif // QGIS_SIP_H