QGIS API Documentation 3.99.0-Master (7d2ca374f2d)
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
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 * discard line
132 */
133#define SIP_SKIP
134
135/*
136 * force a private line to be written
137 */
138#define SIP_FORCE
139
140/*
141 * change the method access to private
142 */
143#define SIP_MAKE_PRIVATE
144
145/*
146 * specify an alternative type for SIP argument or return value
147 */
148#define SIP_PYALTERNATIVETYPE(type)
149
150/*
151 * specify an alternative default value for SIP argument
152 */
153#define SIP_PYARGDEFAULT(value)
154
155/*
156 * remove argument in SIP method
157 */
158#define SIP_PYARGREMOVE
159
160/*
161 * remove argument in SIP method only for Qt version >= 6
162 */
163#define SIP_PYARGREMOVE6
164
165/*
166 * rename argument in SIP method
167 */
168#define SIP_PYARGRENAME(pyname)
169
170/*
171 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-ReleaseGIL
172 */
173#define SIP_RELEASEGIL
174
175/*
176 * https://python-sip.readthedocs.io/en/stable/annotations.html#function-annotation-HoldGIL
177 */
178#define SIP_HOLDGIL
179
180/*
181 * Will insert a `%Feature feature` directive in sip files
182 */
183#define SIP_FEATURE(feature)
184
185/*
186 * Will insert a `%If feature` directive in sip files
187 */
188#define SIP_IF_FEATURE(feature)
189
190/*
191 * Will place the current line with an `%If feature` directive in sip file
192 */
193#define SIP_WHEN_FEATURE(feature)
194
195/*
196 * Convert to subclass code
197 */
198#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
199
200/*
201 * Virtual error handler (/VirtualErrorHandler/)
202 */
203#define SIP_VIRTUALERRORHANDLER(name)
204
205/*
206 * Throw - adds deprecated c++ throw calls for sip. Required for sip to add appropriate
207 * try/catch blocks around call and catch the correct exception, otherwise only
208 * unknown generic exceptions are available for Python code.
209 */
210#define SIP_THROW(name, ...)
211
212/*
213 * Will insert a `%End` directive in sip files
214 */
215#define SIP_END
216
217/*
218 * Class level annotation for abstract classes
219 */
220#define SIP_ABSTRACT
221
222/*
223 * Virtual catcher code
224 */
225#define SIP_VIRTUAL_CATCHER_CODE(code)
226
227/*
228 * Force documentation of templates
229 * Available for SIP 4.19.7+
230 */
231#define SIP_DOC_TEMPLATE
232
233/*
234 * Specifies the type of the value returned by the function as it will appear in any
235 * generated docstrings and PEP 484 type hints. It is usually used with results of type
236 * SIP_PYOBJECT to provide a more specific type.
237 * Available for SIP 4.18+
238 */
239#define SIP_TYPEHINT(type)
240
241/*
242 * Define Python special method (bool, repr, etc.) using the given method or code
243 * sipify.py will create a dedicated python file named according to the class
244 * and located in python/{module}/auto_additions/{classname}.py
245 * a simple method name can be provided (e.g. isValid) and sipify will create the proper code
246 * or some Python code can be provided:
247 *
248 * SIP_PYTHON_SPECIAL_BOOL( isValid )
249 * => sipify => MyClass.__bool__ = lambda self: self.isValid()
250 *
251 * SIP_PYTHON_SPECIAL_REPR( "'<MyClass {}>'format(self.toString())'" )
252 * => sipify => MyClass.__repr__ = lambda self: '<MyClass {}>'format(self.toString())'
253 */
254#define SIP_PYTHON_SPECIAL_BOOL(method_or_code)
255#define SIP_PYTHON_SPECIAL_REPR(method_or_code)
256
257/*
258 * If one reformat an enum to a scope based enum
259 * sipify will take care of monkey patching to keep
260 * API compatibility.
261 * If OUTSIDE_CLASS is defined, the enum has been unnested
262 * from the class, and it will be used for monkey patching
263 * e.g. QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
264 * These macros should be removed in QGIS 5
265 */
266#define SIP_MONKEYPATCH_SCOPEENUM
267#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS,FORMERNAME)
268#define SIP_MONKEYPATCH_FLAGS_UNNEST(OUTSIDE_CLASS,FORMERNAME)
269#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
270
271/*
272 * Directive to define the base type for a enum
273 */
274#define SIP_ENUM_BASETYPE(type)
275
276/*
277 * Directive to define a Python property;
278 */
279#define SIP_PROPERTY(name,getter,setter)
280
281/*
282 * Directive to indicate that following code is only available with Qt 5 version
283 */
284#define SIP_PYQT5_RUN
285
286/*
287 * Adds an include in the type header code
288 */
289#define SIP_TYPEHEADER_INCLUDE(file)
290
291/*
292 * Inserts sip conversion code for QList<class_name::enum_name>, where class_name::enum_name is a c++ enum.
293 *
294 * Extra arguments can contain extra headers to include in the conversion code.
295 */
296#define SIP_INSERT_QLIST_ENUM_CONVERSION_CODE(class_name, ...)
297
298#define SIP_NO_FILE
299
300#endif // QGIS_SIP_H