Skip to content
Permalink
Browse files
Fix sipify constructor detection
  • Loading branch information
m-kuhn committed Apr 2, 2017
1 parent 6681766 commit 68d8108ab363810db8dc2be50901bcd36d954878
Showing with 25 additions and 4 deletions.
  1. +1 −1 scripts/sipify.pl
  2. +12 −1 tests/scripts/sipifyheader.expected.sip
  3. +12 −2 tests/scripts/sipifyheader.h
@@ -253,7 +253,7 @@ sub processDoxygenLine
$line =~ s/\s*=\s*default\b//g;

# remove constructor definition
if ( $line =~ m/^(\s*)?(explicit )?(\w+)\(([^()]*\([^()]*\)[^()]*)*\)(?!;)$/ ){
if ( $line =~ m/^(\s*)?(explicit )?(\w+)\([\w\=\(\)\s\,\&\*\<\>]*\)(?!;)$/ ){
my $newline = $line =~ s/\n/;\n/r;
my $nesting_index = 0;
while(!eof $header){
@@ -66,6 +66,17 @@ A constructor with definition in header
A classic constructor with arguments
%End

QgsSipifyHeader( bool a = true );
%Docstring
A constructor with no empty `()`
%End

QgsSipifyHeader( QList<Point> a, const Issues &b = Issues::weDontHaveIssues(), QgsClass *b = 0 );
%Docstring
A constructor with some special character types
%End
{}

QgsSipifyHeader();
%Docstring
Default constructor
@@ -108,7 +119,7 @@ Factory annotation

void differentDefaultValue( bool defaultValue = false , QWidget *parent = 0, QString msg = "hello" );

void differentType( QList<qint64> &list );
void differentType( QList<qint64> & list );

void complexDefaultValueAndType( QList<QPair<qint64 , QMap<int, QString>>> list = QList<QPair<qint64, QMap<int, QString>>> );
%Docstring
@@ -101,6 +101,16 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private QgsBaseCla
*/
QgsSipifyHeader( QWidget *parent SIP_TRANSFERTHIS = nullptr );

//! A constructor with no empty `()`
QgsSipifyHeader( bool a = true )
: mMember( nullptr )
{}

//! A constructor with some special character types
QgsSipifyHeader( QList<Point> a, const Issues &b = Issues::weDontHaveIssues(), QgsClass *b = nullptr )
: mMember( nullptr )
{}

//! Default constructor
QgsSipifyHeader() = default;

@@ -139,7 +149,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private QgsBaseCla

void differentDefaultValue( bool defaultValue = true SIP_PYDEFAULTVALUE( false ), QWidget *parent = nullptr, QString msg = QString() SIP_PYDEFAULTVALUE( "hello" ) );

void differentType( QList<QgsFeatureId> SIP_PYTYPE( QList<qint64> ) &list );
void differentType( QList<QgsFeatureId> SIP_PYTYPE( QList<qint64> ) & list );

//! complex default value and type (i.e. containing commas) should be given as a string with single quotes
void complexDefaultValueAndType( QList<QPair<QgsFeatureId SIP_PYTYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYDEFAULTVALUE( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );
@@ -152,7 +162,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private QgsBaseCla

void removeProxyFactory( QNetworkProxyFactory *factory SIP_TRANSFERBACK );

bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl ) { doSomething; return true; } // some comments
bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl ) { doSomething; return true; } // some comments

bool deletedFunction() = delete; // some comments

0 comments on commit 68d8108

Please sign in to comment.