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