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