Skip to content

Commit

Permalink
[sipify] remove static const value assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 2, 2017
1 parent 1f3ff11 commit fbd62be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/sipify.pl
Expand Up @@ -465,6 +465,10 @@ sub remove_constructor_or_body {
next;
}

# remove static const value assignment
# https://regex101.com/r/DyWkgn/1
$line =~ s/^(\s*static const \w+(<([\w()<>, ]|::)+>)? \w+) = .*;\s*(\/\/.*)?$/$1;/;

# remove struct member assignment
if ( $SIP_RUN != 1 && $ACCESS[$#ACCESS] == PUBLIC && $line =~ m/^(\s*\w+[\w<> *&:,]* \*?\w+) = \w+(\([^()]+\))?;/ ){
dbg_info("remove struct member assignment");
Expand Down
2 changes: 2 additions & 0 deletions tests/scripts/sipifyheader.expected.sip
Expand Up @@ -89,6 +89,8 @@ class QgsSipifyHeader : QtClass<QVariant>
QgsMapLayer *mLayer;
};

static const int MONTHS;

explicit QgsSipifyHeader();
%Docstring
A constructor with definition in header
Expand Down
2 changes: 2 additions & 0 deletions tests/scripts/sipifyheader.h
Expand Up @@ -134,6 +134,8 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
QgsMapLayer *mLayer = nullptr;
};

static const int MONTHS = 60 * 60 * 24 * 30; // something

//! A constructor with definition in header
explicit QgsSipifyHeader()
: QtClass<QVariant>()
Expand Down

0 comments on commit fbd62be

Please sign in to comment.