Fix sipify constructor detection

This commit is contained in:
Matthias Kuhn 2017-04-02 10:54:04 +02:00
parent 6681766cbb
commit 68d8108ab3
3 changed files with 25 additions and 4 deletions

View File

@ -253,7 +253,7 @@ while(!eof $header){
$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){

View File

@ -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

View File

@ -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