Skip to content
Permalink
Browse files

[sipify] do not comment global operators

fix class/struct level detection
sipify qgsmargins.qgs
  • Loading branch information
3nids authored and m-kuhn committed May 15, 2017
1 parent 3f85b05 commit e455b157b55f03fe43f27e7d8cf8980e3ccb1434
Showing with 51 additions and 13 deletions.
  1. +0 −1 python/auto_sip.blacklist
  2. +38 −0 python/core/qgsmargins.sip
  3. +7 −6 scripts/sipify.pl
  4. +6 −6 src/core/qgsmargins.h
@@ -3,7 +3,6 @@ core/qgsexception.sip
core/qgis.sip
core/qgsexpressioncontext.sip
core/qgsfeaturerequest.sip
core/qgsmargins.sip
core/qgsoptionalexpression.sip
core/qgspaintenginehack.sip
core/qgspainting.sip
@@ -1,3 +1,15 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmargins.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsMargins
{

@@ -138,14 +150,40 @@ class QgsMargins


bool operator==( const QgsMargins &lhs, const QgsMargins &rhs );

bool operator!=( const QgsMargins &lhs, const QgsMargins &rhs );

QgsMargins operator+( const QgsMargins &m1, const QgsMargins &m2 );

QgsMargins operator-( const QgsMargins &m1, const QgsMargins &m2 );

QgsMargins operator+( const QgsMargins &lhs, double rhs );

QgsMargins operator+( double lhs, const QgsMargins &rhs );

QgsMargins operator-( const QgsMargins &lhs, double rhs );

QgsMargins operator*( const QgsMargins &margins, double factor );

QgsMargins operator*( double factor, const QgsMargins &margins );

QgsMargins operator/( const QgsMargins &margins, double divisor );







QgsMargins operator+( const QgsMargins &margins );

QgsMargins operator-( const QgsMargins &margins );


/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmargins.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -93,9 +93,9 @@ sub dbg_info
}

sub remove_constructor_or_body {
# https://regex101.com/r/ZaP3tC/3
# https://regex101.com/r/ZaP3tC/4
do {no warnings 'uninitialized';
if ( $line =~ m/^(\s*)?(explicit )?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+(\*|&)?)?(~?\w+|operator.{1,2})\(([\w=()\/ ,&*<>."-]|::)*\)( (?:const|SIP_[A-Z_]*?))*)\s*((\s*[:,]\s+\w+\(.*\))*\s*\{.*\};?|(?!;))(\s*\/\/.*)?$/
if ( $line =~ m/^(\s*)?(explicit )?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+[*&]?)?(~?\w+|(\w+::)?operator.{1,2})\(([\w=()\/ ,&*<>."-]|::)*\)( (?:const|SIP_[A-Z_]*?))*)\s*((\s*[:,]\s+\w+\(.*\))*\s*\{.*\};?|(?!;))(\s*\/\/.*)?$/
|| $line =~ m/SIP_SKIP\s*(?!;)\s*(\/\/.*)?$/
|| $line =~ m/^\s*class.*SIP_SKIP/ ){
dbg_info("remove constructor definition, function bodies, member initializing list");
@@ -336,7 +336,7 @@ ()
next;
}
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET
if ($line =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE).*?$/){
if ($line =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO).*?$/){
next;
}

@@ -375,11 +375,11 @@ ()
$global_bracket_nesting_index[$#global_bracket_nesting_index] += $bracket_balance;
if ($global_bracket_nesting_index[$#global_bracket_nesting_index] == 0){
dbg_info(" going up in class/struct tree");
if ($#ACCESS > 1){
if ($#ACCESS > 0){
pop(@global_bracket_nesting_index);
pop(@ACCESS);
}
if ($#ACCESS == 1){
if ($#ACCESS == 0){
dbg_info("reached top level");
# top level should stasy public
dbg_info
@@ -439,7 +439,7 @@ ()
}
}

if ( $line =~ m/^(\s*struct)\s+(\w+)$/ ) {
if ( $line =~ m/^\s*struct(\s+\w+_EXPORT)?\s+\w+$/ ) {
dbg_info(" going to struct => public");
push @ACCESS, PUBLIC;
push @global_bracket_nesting_index, 0;
@@ -689,6 +689,7 @@ ()
$line =~ m/\s*typedef / ||
$line =~ m/\s*struct / ||
$line =~ m/operator\[\]\(/ ||
($line =~ m/operator[!+-=*\/\[\]]{1,2}/ && $#ACCESS == 0) || # apparently global operators cannot be documented
$line =~ m/^\s*%\w+(.*)?$/ ){
dbg_info('skipping comment');
$comment = '';
@@ -265,17 +265,17 @@ inline QgsMargins operator/( const QgsMargins &margins, double divisor )
margins.right() / divisor, margins.bottom() / divisor );
}

inline QgsMargins &QgsMargins::operator+=( const QgsMargins &margins )
inline QgsMargins &QgsMargins::operator+=( const QgsMargins &margins ) SIP_SKIP
{
return *this = *this + margins;
}

inline QgsMargins &QgsMargins::operator-=( const QgsMargins &margins )
inline QgsMargins &QgsMargins::operator-=( const QgsMargins &margins ) SIP_SKIP
{
return *this = *this - margins;
}

inline QgsMargins &QgsMargins::operator+=( double addend )
inline QgsMargins &QgsMargins::operator+=( double addend ) SIP_SKIP
{
mLeft += addend;
mTop += addend;
@@ -284,7 +284,7 @@ inline QgsMargins &QgsMargins::operator+=( double addend )
return *this;
}

inline QgsMargins &QgsMargins::operator-=( double subtrahend )
inline QgsMargins &QgsMargins::operator-=( double subtrahend ) SIP_SKIP
{
mLeft -= subtrahend;
mTop -= subtrahend;
@@ -293,12 +293,12 @@ inline QgsMargins &QgsMargins::operator-=( double subtrahend )
return *this;
}

inline QgsMargins &QgsMargins::operator*=( double factor )
inline QgsMargins &QgsMargins::operator*=( double factor ) SIP_SKIP
{
return *this = *this * factor;
}

inline QgsMargins &QgsMargins::operator/=( double divisor )
inline QgsMargins &QgsMargins::operator/=( double divisor ) SIP_SKIP
{
return *this = *this / divisor;
}

0 comments on commit e455b15

Please sign in to comment.
You can’t perform that action at this time.