Skip to content
Permalink
Browse files
followup 45266cd
  • Loading branch information
3nids committed Apr 26, 2017
1 parent 45266cd commit 9688b81874065b1ec9df018a5f23a0eb2ce540ed
Showing with 46 additions and 12 deletions.
  1. +25 −10 scripts/sipify.pl
  2. +11 −1 tests/scripts/sipifyheader.expected.sip
  3. +10 −1 tests/scripts/sipifyheader.h
@@ -441,12 +441,12 @@ sub processDoxygenLine
$line =~ s/\s*=\s*default\b//g;

# remove constructor definition, function bodies, member initializing list
if ( $SIP_RUN != 1 && $line =~ m/^(\s*)?(explicit )?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+(\*|&)?)?(\w+|operator.{1,2})\([\w=()\/ ,&*<>:]*\)( (?:const|SIP_[A-Z_]*?))*)\s*(\{.*\})?(?!;)(\s*\/\/.*)?$/ ){
if ( $SIP_RUN != 1 && $line =~ m/^(\s*)?(explicit )?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+(\*|&)?)?(\w+|operator.{1,2})\([\w=()\/ ,&*<>:-]*\)( (?:const|SIP_[A-Z_]*?))*)\s*(\{.*\})?(?!;)(\s*\/\/.*)?$/ ){
my $newline = "$1$2$3$4$5;";
if ($line !~ m/\{.*?\}$/){
$line = $lines[$line_idx];
$line_idx++;
while ( $line =~ m/^\s*[:,] \w+\(.*?\)/){
while ( $line =~ m/^\s*[:,] [\w<>]+\(.*?\)/){
$line = $lines[$line_idx];
$line_idx++;
}
@@ -455,14 +455,11 @@ sub processDoxygenLine
while ($line_idx < $line_count){
$line = $lines[$line_idx];
$line_idx++;
if ( $line =~ m/^\s*{/ ){
$nesting_index++;
}
elsif ( $line =~ m/\}\s*$/ ){
$nesting_index--;
if ($nesting_index == 0){
last;
}

$nesting_index += $line =~ tr/\{//;
$nesting_index -= $line =~ tr/\}//;
if ($nesting_index == 0){
last;
}
}
}
@@ -533,6 +530,24 @@ sub processDoxygenLine
if ( $MULTILINE_DEFINITION == 1 ){
if ( $line =~ m/^[^()]*([^()]*\([^()]*\)[^()]*)*\)[^()]*$/){
$MULTILINE_DEFINITION = 0;
# remove potential following body
if ( $lines[$line_idx] =~ m/^\s*\{$/ ){
my $last_line = $line;
my $nesting_index = 0;
while ($line_idx < $line_count){
$line = $lines[$line_idx];
$line_idx++;

$nesting_index += $line =~ tr/\{//;
$nesting_index -= $line =~ tr/\}//;
if ($nesting_index == 0){
last;
}
}
# add missing semi column
pop(@output);
push @output, "$last_line;\n";
}
}
else
{
@@ -75,6 +75,7 @@ class QgsSipifyHeader : QtClass<QVariant>
struct Data
{
Data( QgsMapLayer *layer, Qstring name );

QString mName;
int mCount;
QgsMapLayer *mLayer;
@@ -84,6 +85,7 @@ class QgsSipifyHeader : QtClass<QVariant>
%Docstring
A constructor with definition in header
%End

QgsSipifyHeader( QWidget *parent /TransferThis/ = 0 );
%Docstring
A classic constructor with arguments
@@ -93,6 +95,7 @@ A constructor with definition in header
%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
@@ -188,11 +191,16 @@ complex default value and type (i.e. containing commas) should be given as a str

void removeProxyFactory( QNetworkProxyFactory *factory /TransferBack/ );

bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl );
bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl, Some::Thing _part = -1 /*default =-1*/ );
%Docstring
:rtype: bool
%End

void multilineBodyAndDefinition( const QList<int,
QString> &list,
QgsVectorLayer *vl,
Some::Thing _part = -1 /*default =-1*/ );

QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
%Docstring
Removing function body with namespaced return value
@@ -306,6 +314,7 @@ class ClassWithPrivateInheritanceOnly
%Docstring
A constructor with definition in header on several lines
%End

};


@@ -323,6 +332,7 @@ class AbstractClass /Abstract/
%Docstring
A constructor
%End

};

QFlags<QgsSipifyHeader::MyEnum> operator|(QgsSipifyHeader::MyEnum f1, QFlags<QgsSipifyHeader::MyEnum> f2);
@@ -217,7 +217,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas

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, Some::Thing _part = -1 /*default =-1*/ ) { doSomething; return true; } // some comments

static inline QgsMapLayer *skippedMethodWithBody() SIP_SKIP
{
@@ -228,6 +228,15 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
}
}

void multilineBodyAndDefinition( const QList<int,
QString> &list,
QgsVectorLayer *vl,
Some::Thing _part = -1 /*default =-1*/ )
{
doSomething;
return true;
}

//! Removing function body with namespaced return value
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const { return mBuildPyramidsFlag; }

0 comments on commit 9688b81

Please sign in to comment.