Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sipify] fix struct member assignment
  • Loading branch information
3nids committed Apr 19, 2017
1 parent be9a51c commit e5ab2f6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions scripts/sipify.pl
Expand Up @@ -303,6 +303,11 @@ sub processDoxygenLine
next;
}

# remove struct member assignment
if ( $SIP_RUN != 1 && $ACCESS == PUBLIC && $line =~ m/^(\s*\w+[\w<> *&:,]* \*?\w+) = \w+(\([^()]+\))?;/ ){
$line = "$1;\n";
}

# catch Q_DECLARE_FLAGS
if ( $line =~ m/^(\s*)Q_DECLARE_FLAGS\(\s*(.*?)\s*,\s*(.*?)\s*\)\s*$/ ){
$line = "$1typedef QFlags<$classname::$3> $2;\n";
Expand Down
7 changes: 5 additions & 2 deletions tests/scripts/sipifyheader.expected.sip
Expand Up @@ -70,8 +70,11 @@ class QgsSipifyHeader : QtClass<QVariant>

struct Data
{
QString name;
int count;
Data( QgsMapLayer *layer, Qstring name );

QString mName;
int mCount;
QgsMapLayer *mLayer;
};

explicit QgsSipifyHeader();
Expand Down
10 changes: 8 additions & 2 deletions tests/scripts/sipifyheader.h
Expand Up @@ -112,8 +112,14 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
*/
struct Data
{
QString name;
int count;
Data( QgsMapLayer *layer, Qstring name )
: mLayer( layer )
, mName( name )
{}

QString mName;
int mCount = 100;
QgsMapLayer *mLayer = nullptr;
};

//! A constructor with definition in header
Expand Down

0 comments on commit e5ab2f6

Please sign in to comment.