Skip to content
Permalink
Browse files
[sipify] keep external forward declaration
  • Loading branch information
3nids committed May 24, 2017
1 parent 09d3e2f commit f63adfe145975d6d03261a76bf59ee6d0b198f8e
Showing with 28 additions and 11 deletions.
  1. +1 −0 cmake_templates/Doxyfile.in
  2. +3 −2 python/core/effects/qgspainteffectregistry.sip
  3. +13 −5 scripts/sipify.pl
  4. +6 −4 src/core/effects/qgspainteffectregistry.h
  5. +5 −0 src/core/qgis_sip.h
@@ -2056,6 +2056,7 @@ EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_CONVERT_TO_SUBCLASS_CODE" \
"SIP_DEPRECATED" \
"SIP_END" \
"SIP_EXTERNAL" \
"SIP_FACTORY" \
"SIP_FEATURE" \
"SIP_IF_FEATURE" \
@@ -8,6 +8,7 @@



class QgsPaintEffectWidget /External/;

class QgsPaintEffectAbstractMetadata
{
@@ -73,8 +74,6 @@ class QgsPaintEffectAbstractMetadata

};

typedef QgsPaintEffect *( *QgsPaintEffectCreateFunc )( const QgsStringMap & );
typedef QgsPaintEffectWidget *( *QgsPaintEffectWidgetFunc )();



@@ -161,6 +160,8 @@ class QgsPaintEffectRegistry
:rtype: bool
%End

private:
QgsPaintEffectRegistry( const QgsPaintEffectRegistry &rh );
};

/************************************************************************
@@ -151,6 +151,7 @@ ()
$line =~ s/\bSIP_ARRAYSIZE\b/\/ArraySize\//g;
$line =~ s/\bSIP_DEPRECATED\b/\/Deprecated\//g;
$line =~ s/\bSIP_CONSTRAINED\b/\/Constrained\//g;
$line =~ s/\bSIP_EXTERNAL\b/\/External\//g;
$line =~ s/\bSIP_FACTORY\b/\/Factory\//;
$line =~ s/\bSIP_IN\b/\/In\//g;
$line =~ s/\bSIP_INOUT\b/\/In,Out\//g;
@@ -357,9 +358,16 @@ sub detect_comment_block{
}

# Skip forward declarations
if ($line =~ m/^\s*(class|struct) \w+;\s*(\/\/.*)?$/){
dbg_info('skipping forward declaration');
next;
if ($line =~ m/^\s*(class|struct) \w+(?<external> *SIP_EXTERNAL)?;\s*(\/\/.*)?$/){
if ($+{external}){
dbg_info('do not skip external forward declaration');
$comment = '';
}
else
{
dbg_info('skipping forward declaration');
next;
}
}
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET
if ($line =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED).*?$/){
@@ -401,8 +409,8 @@ sub detect_comment_block{
}

# class declaration started
# https://regex101.com/r/6FWntP/5
if ( $line =~ m/^(\s*class)\s+([A-Z]+_EXPORT\s+)?(\w+)(\s*\:\s*(public|private)\s+\w+(<([\w]|::)+>)?(::\w+(<\w+>)?)*(,\s*(public|private)\s+\w+(<([\w]|::)+>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*SIP_.*)?$/ ){
# https://regex101.com/r/6FWntP/6
if ( $line =~ m/^(\s*class)\s+([A-Z]+_EXPORT\s+)?(\w+)(\s*\:\s*(public|private)\s+\w+(<([\w]|::)+>)?(::\w+(<\w+>)?)*(,\s*(public|private)\s+\w+(<([\w]|::)+>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*SIP_\w+)?(?!;)$/ ){
dbg_info("class definition started");
push @ACCESS, PUBLIC;
push @EXPORTED, 0;
@@ -17,13 +17,12 @@
#define QGSPAINTEFFECTREGISTRY_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgis.h"
#include <QDomElement>
#include <QDomDocument>

class QgsPaintEffect;
class QgsPaintEffectWidget;
class QgsPaintEffectWidget SIP_EXTERNAL;

/** \ingroup core
* \class QgsPaintEffectAbstractMetadata
@@ -77,8 +76,8 @@ class CORE_EXPORT QgsPaintEffectAbstractMetadata

};

typedef QgsPaintEffect *( *QgsPaintEffectCreateFunc )( const QgsStringMap & );
typedef QgsPaintEffectWidget *( *QgsPaintEffectWidgetFunc )();
typedef QgsPaintEffect *( *QgsPaintEffectCreateFunc )( const QgsStringMap & ) SIP_SKIP;
typedef QgsPaintEffectWidget *( *QgsPaintEffectWidgetFunc )() SIP_SKIP;

/** \ingroup core
* \class QgsPaintEffectMetadata
@@ -219,6 +218,9 @@ class CORE_EXPORT QgsPaintEffectRegistry
static bool isDefaultStack( QgsPaintEffect *effect );

private:
#ifdef SIP_RUN
QgsPaintEffectRegistry( const QgsPaintEffectRegistry &rh );
#endif

QMap<QString, QgsPaintEffectAbstractMetadata *> mMetadata;
};
@@ -91,6 +91,11 @@
*/
#define SIP_CONSTRAINED

/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=external#class-annotation-External
*/
#define SIP_EXTERNAL

/*
* discard line
*/

0 comments on commit f63adfe

Please sign in to comment.