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