Skip to content

Commit

Permalink
[sifpiy] handle multiline body
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Apr 24, 2017
1 parent 46310d4 commit 085803d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/sipify.pl
Expand Up @@ -434,12 +434,19 @@ sub processDoxygenLine
if ($line !~ m/\{.*?\}$/){
$line = $lines[$line_idx];
$line_idx++;
my $nesting_index = 1;
if ( $line =~ m/^\s*\{\s*$/ ){
while ($line_idx < $line_count){
$line = $lines[$line_idx];
$line_idx++;
if ( $line =~ m/\}\s*$/ ){
last;
if ( $line =~ m/^\s*{/ ){
$nesting_index++;
}
elsif ( $line =~ m/\}\s*$/ ){
$nesting_index--;
if ($nesting_index == 0){
last;
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions tests/scripts/sipifyheader.expected.sip
Expand Up @@ -206,6 +206,12 @@ Removing function body with virtual const reference
:rtype: QgsLayerMetadata
%End

bool myMultiLineBody();
%Docstring
Mulitline body
:rtype: bool
%End


virtual int overriddenProperty();
virtual int overrideWithoutVirtual();
Expand Down
13 changes: 13 additions & 0 deletions tests/scripts/sipifyheader.h
Expand Up @@ -230,6 +230,19 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
//! Removing function body with virtual const reference
virtual const QgsLayerMetadata &metadata() const { return mMetadata; }

//! Mulitline body
bool myMultiLineBody()
{
if (isTrue())
{
return false;
}
else
{
return true;
}
}

bool deletedFunction() = delete; // some comments

virtual int overriddenProperty() override { return 42; } // if in doubt, comment it out
Expand Down

0 comments on commit 085803d

Please sign in to comment.