Skip to content

Commit

Permalink
[sipify] use a distinct header to simplify includes
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
3nids committed May 4, 2017
1 parent 41dc9d1 commit cc887c6
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 120 deletions.
1 change: 1 addition & 0 deletions python/core/qgscoordinatetransform.sip
Expand Up @@ -9,6 +9,7 @@




class QgsCoordinateTransform
{
%Docstring
Expand Down
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -684,6 +684,7 @@ SET(QGIS_CORE_HDRS
../plugins/qgisplugin.h

qgis.h
qgis_sip.h
qgsaction.h
qgsactionscope.h
qgsactionmanager.h
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgis.cpp
Expand Up @@ -27,7 +27,7 @@
#include <QDateTime>
#include "qgsconfig.h"
#include "qgslogger.h"
#include "geometry/qgswkbtypes.h"
#include "qgswkbtypes.h"

#include <ogr_api.h>

Expand Down
121 changes: 5 additions & 116 deletions src/core/qgis.h
Expand Up @@ -34,6 +34,8 @@

#include "qgswkbtypes.h"
#include "qgis_core.h"
#include "qgis_sip.h"


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


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

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

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Transfer
*
* Example QgsVectorLayer::setDiagramRenderer
*/
#define SIP_TRANSFER

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferBack
*/
#define SIP_TRANSFERBACK

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferThis
*/
#define SIP_TRANSFERTHIS

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
*/
#define SIP_OUT

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
*/
#define SIP_IN

/*
* Combination of
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
* and
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
*/
#define SIP_INOUT

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Factory
*/
#define SIP_FACTORY

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-PyName
*/
#define SIP_PYNAME(name)

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-KeepReference
*/
#define SIP_KEEPREFERENCE

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Array
*/
#define SIP_ARRAY

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-ArraySize
*/
#define SIP_ARRAYSIZE

/*
* discard line
*/
#define SIP_SKIP

/*
* force a private line to be written
*/
#define SIP_FORCE

/*
* specify an alternative type for SIP argument or return value
*/
#define SIP_PYTYPE(type)

/*
* specify an alternative default value for SIP argument
*/
#define SIP_PYARGDEFAULT(value)

/*
* remove argument in SIP method
*/
#define SIP_PYARGREMOVE


/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
*/
#define SIP_RELEASEGIL

/*
* Will insert a `%Feature feature` directive in sip files
*/
#define SIP_FEATURE(feature)

/*
* Will insert a `%If feature` directive in sip files
*/
#define SIP_IF_FEATURE(feature)

/*
* Convert to subclass code
*/
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)

/*
* Will insert a `%End` directive in sip files
*/
#define SIP_END

/*
* Class level annotation for abstract classes
*/
#define SIP_ABSTRACT
136 changes: 136 additions & 0 deletions src/core/qgis_sip.h
@@ -0,0 +1,136 @@
/***************************************************************************
qgis_sip - QGIS SIP Macros
---------------------
begin : 4.5.2017
copyright : (C) 2017 by Denis Rouzaud
email : denis.rouzaud@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGIS_SIP_H
#define QGIS_SIP_H

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Transfer
*
* Example QgsVectorLayer::setDiagramRenderer
*/
#define SIP_TRANSFER

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferBack
*/
#define SIP_TRANSFERBACK

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-TransferThis
*/
#define SIP_TRANSFERTHIS

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
*/
#define SIP_OUT

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
*/
#define SIP_IN

/*
* Combination of
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-In
* and
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-Out
*/
#define SIP_INOUT

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-Factory
*/
#define SIP_FACTORY

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-PyName
*/
#define SIP_PYNAME(name)

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#argument-annotation-KeepReference
*/
#define SIP_KEEPREFERENCE

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-Array
*/
#define SIP_ARRAY

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html#argument-annotation-ArraySize
*/
#define SIP_ARRAYSIZE

/*
* discard line
*/
#define SIP_SKIP

/*
* force a private line to be written
*/
#define SIP_FORCE

/*
* specify an alternative type for SIP argument or return value
*/
#define SIP_PYTYPE(type)

/*
* specify an alternative default value for SIP argument
*/
#define SIP_PYARGDEFAULT(value)

/*
* remove argument in SIP method
*/
#define SIP_PYARGREMOVE


/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
*/
#define SIP_RELEASEGIL

/*
* Will insert a `%Feature feature` directive in sip files
*/
#define SIP_FEATURE(feature)

/*
* Will insert a `%If feature` directive in sip files
*/
#define SIP_IF_FEATURE(feature)

/*
* Convert to subclass code
*/
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)

/*
* Will insert a `%End` directive in sip files
*/
#define SIP_END

/*
* Class level annotation for abstract classes
*/
#define SIP_ABSTRACT


#endif // QGIS_SIP_H
4 changes: 3 additions & 1 deletion src/core/qgscoordinatetransform.h
Expand Up @@ -17,8 +17,10 @@
#ifndef QGSCOORDINATETRANSFORM_H
#define QGSCOORDINATETRANSFORM_H

#include "qgis_core.h"
#include <QExplicitlySharedDataPointer>

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgscoordinatereferencesystem.h"

class QgsCoordinateTransformPrivate;
Expand Down
5 changes: 3 additions & 2 deletions src/core/qgslogger.h
Expand Up @@ -19,6 +19,7 @@
#define QGSLOGGER_H

#include <iostream>
#include "qgis_sip.h"
#include <sstream>
#include <QString>
#include <QTime>
Expand Down Expand Up @@ -70,12 +71,12 @@ class CORE_EXPORT QgsLogger

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

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

0 comments on commit cc887c6

Please sign in to comment.