Skip to content

Commit cc887c6

Browse files
committedMay 4, 2017
[sipify] use a distinct header to simplify includes
there was an issue in libdxf which includes qgslogger in debug mode and qgsdebug.h includes qgis.h include qgswkbtypes.h (which geometry directory was not listed in libdxrw included paths)
1 parent 41dc9d1 commit cc887c6

File tree

7 files changed

+150
-120
lines changed

7 files changed

+150
-120
lines changed
 

‎python/core/qgscoordinatetransform.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010

1111

12+
1213
class QgsCoordinateTransform
1314
{
1415
%Docstring

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ SET(QGIS_CORE_HDRS
684684
../plugins/qgisplugin.h
685685

686686
qgis.h
687+
qgis_sip.h
687688
qgsaction.h
688689
qgsactionscope.h
689690
qgsactionmanager.h

‎src/core/qgis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <QDateTime>
2828
#include "qgsconfig.h"
2929
#include "qgslogger.h"
30-
#include "geometry/qgswkbtypes.h"
30+
#include "qgswkbtypes.h"
3131

3232
#include <ogr_api.h>
3333

‎src/core/qgis.h

Lines changed: 5 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
#include "qgswkbtypes.h"
3636
#include "qgis_core.h"
37+
#include "qgis_sip.h"
38+
3739

3840
/** \ingroup core
3941
* The Qgis class provides global constants for use throughout the application.
@@ -127,6 +129,7 @@ class CORE_EXPORT Qgis
127129
// QLibrary
128130
#define cast_to_fptr(f) f
129131

132+
130133
/** \ingroup core
131134
* RAII signal blocking class. Used for temporarily blocking signals from a QObject
132135
* for the lifetime of QgsSignalBlocker object.
@@ -135,7 +138,7 @@ class CORE_EXPORT Qgis
135138
* \note not available in Python bindings
136139
*/
137140
// based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
138-
template<class Object> class QgsSignalBlocker // clazy:exclude=rule-of-three
141+
template<class Object> class QgsSignalBlocker SIP_SKIP // clazy:exclude=rule-of-three
139142
{
140143
public:
141144

@@ -175,7 +178,7 @@ template<class Object> class QgsSignalBlocker // clazy:exclude=rule-of-three
175178
* \note not available in Python bindings
176179
*/
177180
// based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
178-
template<class Object> inline QgsSignalBlocker<Object> whileBlocking( Object *object )
181+
template<class Object> inline QgsSignalBlocker<Object> whileBlocking( Object *object ) SIP_SKIP
179182
{
180183
return QgsSignalBlocker<Object>( object );
181184
}
@@ -391,118 +394,4 @@ typedef unsigned long long qgssize;
391394
#define FALLTHROUGH
392395
#endif
393396

394-
/*
395-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Transfer
396-
*
397-
* Example QgsVectorLayer::setDiagramRenderer
398-
*/
399-
#define SIP_TRANSFER
400-
401-
/*
402-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferBack
403-
*/
404-
#define SIP_TRANSFERBACK
405397

406-
/*
407-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferThis
408-
*/
409-
#define SIP_TRANSFERTHIS
410-
411-
/*
412-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
413-
*/
414-
#define SIP_OUT
415-
416-
/*
417-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
418-
*/
419-
#define SIP_IN
420-
421-
/*
422-
* Combination of
423-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
424-
* and
425-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
426-
*/
427-
#define SIP_INOUT
428-
429-
/*
430-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Factory
431-
*/
432-
#define SIP_FACTORY
433-
434-
/*
435-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-PyName
436-
*/
437-
#define SIP_PYNAME(name)
438-
439-
/*
440-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-KeepReference
441-
*/
442-
#define SIP_KEEPREFERENCE
443-
444-
/*
445-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Array
446-
*/
447-
#define SIP_ARRAY
448-
449-
/*
450-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-ArraySize
451-
*/
452-
#define SIP_ARRAYSIZE
453-
454-
/*
455-
* discard line
456-
*/
457-
#define SIP_SKIP
458-
459-
/*
460-
* force a private line to be written
461-
*/
462-
#define SIP_FORCE
463-
464-
/*
465-
* specify an alternative type for SIP argument or return value
466-
*/
467-
#define SIP_PYTYPE(type)
468-
469-
/*
470-
* specify an alternative default value for SIP argument
471-
*/
472-
#define SIP_PYARGDEFAULT(value)
473-
474-
/*
475-
* remove argument in SIP method
476-
*/
477-
#define SIP_PYARGREMOVE
478-
479-
480-
/*
481-
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
482-
*/
483-
#define SIP_RELEASEGIL
484-
485-
/*
486-
* Will insert a `%Feature feature` directive in sip files
487-
*/
488-
#define SIP_FEATURE(feature)
489-
490-
/*
491-
* Will insert a `%If feature` directive in sip files
492-
*/
493-
#define SIP_IF_FEATURE(feature)
494-
495-
/*
496-
* Convert to subclass code
497-
*/
498-
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
499-
500-
/*
501-
* Will insert a `%End` directive in sip files
502-
*/
503-
#define SIP_END
504-
505-
/*
506-
* Class level annotation for abstract classes
507-
*/
508-
#define SIP_ABSTRACT

‎src/core/qgis_sip.h

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/***************************************************************************
2+
qgis_sip - QGIS SIP Macros
3+
4+
---------------------
5+
begin : 4.5.2017
6+
copyright : (C) 2017 by Denis Rouzaud
7+
email : denis.rouzaud@gmail.com
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+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Transfer
21+
*
22+
* Example QgsVectorLayer::setDiagramRenderer
23+
*/
24+
#define SIP_TRANSFER
25+
26+
/*
27+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferBack
28+
*/
29+
#define SIP_TRANSFERBACK
30+
31+
/*
32+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferThis
33+
*/
34+
#define SIP_TRANSFERTHIS
35+
36+
/*
37+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
38+
*/
39+
#define SIP_OUT
40+
41+
/*
42+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
43+
*/
44+
#define SIP_IN
45+
46+
/*
47+
* Combination of
48+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
49+
* and
50+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
51+
*/
52+
#define SIP_INOUT
53+
54+
/*
55+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Factory
56+
*/
57+
#define SIP_FACTORY
58+
59+
/*
60+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-PyName
61+
*/
62+
#define SIP_PYNAME(name)
63+
64+
/*
65+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-KeepReference
66+
*/
67+
#define SIP_KEEPREFERENCE
68+
69+
/*
70+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Array
71+
*/
72+
#define SIP_ARRAY
73+
74+
/*
75+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-ArraySize
76+
*/
77+
#define SIP_ARRAYSIZE
78+
79+
/*
80+
* discard line
81+
*/
82+
#define SIP_SKIP
83+
84+
/*
85+
* force a private line to be written
86+
*/
87+
#define SIP_FORCE
88+
89+
/*
90+
* specify an alternative type for SIP argument or return value
91+
*/
92+
#define SIP_PYTYPE(type)
93+
94+
/*
95+
* specify an alternative default value for SIP argument
96+
*/
97+
#define SIP_PYARGDEFAULT(value)
98+
99+
/*
100+
* remove argument in SIP method
101+
*/
102+
#define SIP_PYARGREMOVE
103+
104+
105+
/*
106+
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
107+
*/
108+
#define SIP_RELEASEGIL
109+
110+
/*
111+
* Will insert a `%Feature feature` directive in sip files
112+
*/
113+
#define SIP_FEATURE(feature)
114+
115+
/*
116+
* Will insert a `%If feature` directive in sip files
117+
*/
118+
#define SIP_IF_FEATURE(feature)
119+
120+
/*
121+
* Convert to subclass code
122+
*/
123+
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
124+
125+
/*
126+
* Will insert a `%End` directive in sip files
127+
*/
128+
#define SIP_END
129+
130+
/*
131+
* Class level annotation for abstract classes
132+
*/
133+
#define SIP_ABSTRACT
134+
135+
136+
#endif // QGIS_SIP_H

‎src/core/qgscoordinatetransform.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#ifndef QGSCOORDINATETRANSFORM_H
1818
#define QGSCOORDINATETRANSFORM_H
1919

20-
#include "qgis_core.h"
2120
#include <QExplicitlySharedDataPointer>
21+
22+
#include "qgis_core.h"
23+
#include "qgis_sip.h"
2224
#include "qgscoordinatereferencesystem.h"
2325

2426
class QgsCoordinateTransformPrivate;

‎src/core/qgslogger.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define QGSLOGGER_H
2020

2121
#include <iostream>
22+
#include "qgis_sip.h"
2223
#include <sstream>
2324
#include <QString>
2425
#include <QTime>
@@ -70,12 +71,12 @@ class CORE_EXPORT QgsLogger
7071

7172
//! Similar to the previous method, but prints a variable double-value pair
7273
//! \note not available in Python bindings
73-
static void debug( const QString &var, double val, int debuglevel = 1, const char *file = nullptr, const char *function = nullptr, int line = -1 );
74+
static void debug( const QString &var, double val, int debuglevel = 1, const char *file = nullptr, const char *function = nullptr, int line = -1 ) SIP_SKIP;
7475

7576
//! Prints out a variable/value pair for types with overloaded operator<<
7677
//! \note not available in Python bindings
7778
template <typename T> static void debug( const QString &var, T val, const char *file = nullptr, const char *function = nullptr,
78-
int line = -1, int debuglevel = 1 )
79+
int line = -1, int debuglevel = 1 ) SIP_SKIP
7980
{
8081
std::ostringstream os;
8182
os << var.toLocal8Bit().data() << " = " << val;

0 commit comments

Comments
 (0)