QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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  * http://pyqt.sourceforge.net/Docs/sip4/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  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferBack
47  */
48 #define SIP_TRANSFERBACK
49 
50 /*
51  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferThis
52  */
53 #define SIP_TRANSFERTHIS
54 
55 /*
56  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Out
57  */
58 #define SIP_OUT
59 
60 /*
61  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-In
62  */
63 #define SIP_IN
64 
65 /*
66  * Combination of
67  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-In
68  * and
69  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Out
70  */
71 #define SIP_INOUT
72 
73 /*
74  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#function-annotation-Factory
75  */
76 #define SIP_FACTORY
77 
78 /*
79  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#class-annotation-PyName
80  */
81 #define SIP_PYNAME(name)
82 
83 /*
84  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-KeepReference
85  */
86 #define SIP_KEEPREFERENCE
87 
88 /*
89  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Array
90  */
91 #define SIP_ARRAY
92 
93 /*
94  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-ArraySize
95  */
96 #define SIP_ARRAYSIZE
97 
98 /*
99  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html#class-annotation-NoDefaultCtors
100  */
101 #define SIP_NODEFAULTCTORS
102 
103 /*
104  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=deprecated#function-annotation-Deprecated
105  */
106 #define SIP_DEPRECATED
107 
108 /*
109  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=constrained#argument-annotation-Constrained
110  */
111 #define SIP_CONSTRAINED
112 
113 /*
114  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=external#class-annotation-External
115  */
116 #define SIP_EXTERNAL
117 
118 /*
119  * http://pyqt.sourceforge.net/Docs/sip4/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  * http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
151  */
152 #define SIP_RELEASEGIL
153 
154 /*
155  * Will insert a `%Feature feature` directive in sip files
156  */
157 #define SIP_FEATURE(feature)
158 
159 /*
160  * Will insert a `%If feature` directive in sip files
161  */
162 #define SIP_IF_FEATURE(feature)
163 
164 /*
165  * Will place the current line with an `%If feature` directive in sip file
166  */
167 #define SIP_WHEN_FEATURE(feature)
168 
169 /*
170  * Convert to subclass code
171  */
172 #define SIP_CONVERT_TO_SUBCLASS_CODE(code)
173 
174 /*
175  * Virtual error handler (/VirtualErrorHandler/)
176  */
177 #define SIP_VIRTUALERRORHANDLER(name)
178 
179 /*
180  * Throw - adds deprecated c++ throw calls for sip. Required for sip to add appropriate
181  * try/catch blocks around call and catch the correct exception, otherwise only
182  * unknown generic exceptions are available for Python code.
183  */
184 #define SIP_THROW(name)
185 
186 /*
187  * Will insert a `%End` directive in sip files
188  */
189 #define SIP_END
190 
191 /*
192  * Class level annotation for abstract classes
193  */
194 #define SIP_ABSTRACT
195 
196 /*
197  * Virtual catcher code
198  */
199 #define SIP_VIRTUAL_CATCHER_CODE(code)
200 
201 /*
202  * Force documentation of templates
203  * Available for SIP 4.19.7+
204  */
205 #define SIP_DOC_TEMPLATE
206 
207 /*
208  * Specifies the type of the value returned by the function as it will appear in any
209  * generated docstrings and PEP 484 type hints. It is usually used with results of type
210  * SIP_PYOBJECT to provide a more specific type.
211  * Available for SIP 4.18+
212  */
213 #define SIP_TYPEHINT(type)
214 
215 /*
216  * Sip supports the final keyword since version 4.19.0, earlier than that
217  * we will have build issues because it tries to override final methods.
218  */
219 #if SIP_VERSION < 0x041300
220 #if defined FINAL
221 #undef FINAL
222 #endif
223 #define FINAL override
224 #endif
225 
226 /*
227  * Define Python special method (bool, repr, etc.) using the given method or code
228  * sipify.pl will create a dedicated python file named according to the class
229  * and located in python/{module}/auto_additions/{classname}.py
230  * a simple method name can be provided (e.g. isValid) and sipify will create the proper code
231  * or some Python code can be provided:
232  *
233  * SIP_PYTHON_SPECIAL_BOOL( isValid )
234  * => sipify => MyClass.__bool__ = lambda self: self.isValid()
235  *
236  * SIP_PYTHON_SPECIAL_REPR( "'<MyClass {}>'format(self.toString())'" )
237  * => sipify => MyClass.__repr__ = lambda self: '<MyClass {}>'format(self.toString())'
238  */
239 #define SIP_PYTHON_SPECIAL_BOOL(method_or_code)
240 #define SIP_PYTHON_SPECIAL_REPR(method_or_code)
241 
242 /*
243  * If one reformat an enum to a scope based enum
244  * sipify will take care of monkey patching to keep
245  * API compatibility.
246  * If OUTSIDE_CLASS is defined, the enum has been unnested
247  * from the class, and it will be used for monkey patching
248  * e.g. QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
249  * These macros should be removed in QGIS 4
250  */
251 #define SIP_MONKEYPATCH_SCOPEENUM
252 #define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS,FORMERNAME)
253 
254 
255 #endif // QGIS_SIP_H