QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 : [email protected]
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  * specify an alternative type for SIP argument or return value
135  */
136 #define SIP_PYALTERNATIVETYPE(type)
137 
138 /*
139  * specify an alternative default value for SIP argument
140  */
141 #define SIP_PYARGDEFAULT(value)
142 
143 /*
144  * remove argument in SIP method
145  */
146 #define SIP_PYARGREMOVE
147 
148 
149 /*
150  * https://www.riverbankcomputing.com/static/Docs/sip/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
151  */
152 #define SIP_RELEASEGIL
153 
154 /*
155  * https://www.riverbankcomputing.com/static/Docs/sip/annotations.html?highlight=keepreference#function-annotation-HoldGIL
156  */
157 #define SIP_HOLDGIL
158 
159 /*
160  * Will insert a `%Feature feature` directive in sip files
161  */
162 #define SIP_FEATURE(feature)
163 
164 /*
165  * Will insert a `%If feature` directive in sip files
166  */
167 #define SIP_IF_FEATURE(feature)
168 
169 /*
170  * Will place the current line with an `%If feature` directive in sip file
171  */
172 #define SIP_WHEN_FEATURE(feature)
173 
174 /*
175  * Convert to subclass code
176  */
177 #define SIP_CONVERT_TO_SUBCLASS_CODE(code)
178 
179 /*
180  * Virtual error handler (/VirtualErrorHandler/)
181  */
182 #define SIP_VIRTUALERRORHANDLER(name)
183 
184 /*
185  * Throw - adds deprecated c++ throw calls for sip. Required for sip to add appropriate
186  * try/catch blocks around call and catch the correct exception, otherwise only
187  * unknown generic exceptions are available for Python code.
188  */
189 #define SIP_THROW(name)
190 
191 /*
192  * Will insert a `%End` directive in sip files
193  */
194 #define SIP_END
195 
196 /*
197  * Class level annotation for abstract classes
198  */
199 #define SIP_ABSTRACT
200 
201 /*
202  * Virtual catcher code
203  */
204 #define SIP_VIRTUAL_CATCHER_CODE(code)
205 
206 /*
207  * Force documentation of templates
208  * Available for SIP 4.19.7+
209  */
210 #define SIP_DOC_TEMPLATE
211 
212 /*
213  * Specifies the type of the value returned by the function as it will appear in any
214  * generated docstrings and PEP 484 type hints. It is usually used with results of type
215  * SIP_PYOBJECT to provide a more specific type.
216  * Available for SIP 4.18+
217  */
218 #define SIP_TYPEHINT(type)
219 
220 /*
221  * Sip supports the final keyword since version 4.19.0, earlier than that
222  * we will have build issues because it tries to override final methods.
223  */
224 #if SIP_VERSION < 0x041300
225 #if defined FINAL
226 #undef FINAL
227 #endif
228 #define FINAL override
229 #endif
230 
231 /*
232  * Define Python special method (bool, repr, etc.) using the given method or code
233  * sipify.pl will create a dedicated python file named according to the class
234  * and located in python/{module}/auto_additions/{classname}.py
235  * a simple method name can be provided (e.g. isValid) and sipify will create the proper code
236  * or some Python code can be provided:
237  *
238  * SIP_PYTHON_SPECIAL_BOOL( isValid )
239  * => sipify => MyClass.__bool__ = lambda self: self.isValid()
240  *
241  * SIP_PYTHON_SPECIAL_REPR( "'<MyClass {}>'format(self.toString())'" )
242  * => sipify => MyClass.__repr__ = lambda self: '<MyClass {}>'format(self.toString())'
243  */
244 #define SIP_PYTHON_SPECIAL_BOOL(method_or_code)
245 #define SIP_PYTHON_SPECIAL_REPR(method_or_code)
246 
247 /*
248  * If one reformat an enum to a scope based enum
249  * sipify will take care of monkey patching to keep
250  * API compatibility.
251  * If OUTSIDE_CLASS is defined, the enum has been unnested
252  * from the class, and it will be used for monkey patching
253  * e.g. QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
254  * These macros should be removed in QGIS 4
255  */
256 #define SIP_MONKEYPATCH_SCOPEENUM
257 #define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS,FORMERNAME)
258 #define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
259 
260 /*
261  * Directive to define a Python property;
262  */
263 #define SIP_PROPERTY(name,getter,setter)
264 
265 #endif // QGIS_SIP_H