Skip to content

Commit

Permalink
[sipify] Fix stripping function body with virtual const reference ret…
Browse files Browse the repository at this point in the history
…urns
  • Loading branch information
nyalldawson committed Apr 11, 2017
1 parent 5fb63c0 commit 669fa87
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/sipify.pl
Expand Up @@ -347,7 +347,7 @@ sub processDoxygenLine
}

# remove function bodies
if ( $line =~ m/^(\s*)?(const )?(virtual |static )?(([\w:]+(<.*?>)?\s+(\*|&)?)?(\w+|operator.{1,2})\(.*?(\(.*\))*.*\)( (?:const|SIP_[A-Z_]*?))*)\s*(\{.*\})?(?!;)(\s*\/\/.*)?$/ ){
if ( $line =~ m/^(\s*)?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+(\*|&)?)?(\w+|operator.{1,2})\(.*?(\(.*\))*.*\)( (?:const|SIP_[A-Z_]*?))*)\s*(\{.*\})?(?!;)(\s*\/\/.*)?$/ ){
my $newline = "$1$2$3$4;\n";
if ($line !~ m/\{.*?\}$/){
$line = readline $header;
Expand Down
6 changes: 6 additions & 0 deletions tests/scripts/sipifyheader.expected.sip
Expand Up @@ -190,6 +190,12 @@ Removing function body with namespaced return value
:rtype: QgsRaster.RasterBuildPyramids
%End

virtual const QgsLayerMetadata &metadata() const;
%Docstring
Removing function body with virtual const reference
:rtype: QgsLayerMetadata
%End


virtual int overriddenProperty();
%Docstring
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/sipifyheader.h
Expand Up @@ -205,6 +205,9 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
//! Removing function body with namespaced return value
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const { return mBuildPyramidsFlag; }

//! Removing function body with virtual const reference
virtual const QgsLayerMetadata &metadata() const { return mMetadata; }

bool deletedFunction() = delete; // some comments

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

0 comments on commit 669fa87

Please sign in to comment.