Skip to content
Permalink
Browse files
sipify improvements
 * reset comment while changing section
 * fix comment at the end of a comment block
 * use SIP_FORCE to show private members
  • Loading branch information
3nids committed Apr 24, 2017
1 parent 68e0a62 commit 6e7b753ceb2db97bba909b57f6083982e97b44c5
Showing with 22 additions and 1 deletion.
  1. +13 −1 scripts/sipify.pl
  2. +5 −0 src/core/qgis.h
  3. +2 −0 tests/scripts/sipifyheader.expected.sip
  4. +2 −0 tests/scripts/sipifyheader.h
@@ -127,6 +127,7 @@ sub processDoxygenLine
}
elsif ( $line =~ m/^\s*#endif/ ){
if ( $nesting_index == 0 ){
$comment = '';
$SIP_RUN = 0;
last;
}
@@ -156,6 +157,7 @@ sub processDoxygenLine
}
elsif ( $line =~ m/^\s*#endif/ ){
if ( $nesting_index == 0 ){
$comment = '';
$SIP_RUN = 0;
last;
}
@@ -205,18 +207,26 @@ sub processDoxygenLine
if ( $line =~ m/^\s*private( slots)?:/ ){
$ACCESS = PRIVATE;
$private_section_line = $line;
$comment = '';
next;
}
elsif ( $line =~ m/^\s*(public)( slots)?:.*$/ ){
$ACCESS = PUBLIC;
$comment = '';
}
elsif ( $line =~ m/^\};.*$/ ) {
$ACCESS = PUBLIC;
$comment = '';
}
elsif ( $line =~ m/^\s*(protected)( slots)?:.*$/ ){
$ACCESS = PROTECTED;
$comment = '';
}
elsif ( $ACCESS == PRIVATE && $line =~ m/SIP_FORCE/){
push @output, $private_section_line."\n";
}
elsif ( $ACCESS == PRIVATE && $SIP_RUN == 0 ) {
$comment = '';
next;
}
# Skip assignment operator
@@ -236,7 +246,7 @@ sub processDoxygenLine
$line = $lines[$line_idx];
$line_idx++;
$comment .= processDoxygenLine( $line =~ s/\s*\*?(.*?)(\/)?\n?$/$1/r );
if ( $line =~ m/\*\/$/ ){
if ( $line =~ m/\*\/\s*(\/\/.*?)?$/ ){
last;
}
}
@@ -467,6 +477,8 @@ sub processDoxygenLine
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
$line =~ s/=\s+[^=]*?\s+SIP_PYDEFAULTVALUE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;

$line =~ s/SIP_FORCE//;

# fix astyle placing space after % character
$line =~ s/\s*% (MappedType|TypeHeaderCode|ConvertFromTypeCode|ConvertToTypeCode|MethodCode|End)/%$1/;
$line =~ s/\/\s+GetWrapper\s+\//\/GetWrapper\//;
@@ -438,6 +438,11 @@ typedef unsigned long long qgssize;
*/
#define SIP_SKIP

/*
* force a private line to be written
*/
#define SIP_FORCE

/*
* specify an alternative type for SIP methods
*/
@@ -262,6 +262,8 @@ Removing function body with virtual const reference
public:
void FallBackToPublic();

private:
void ShowThisPrivateOne() ;
};

class ClassWithPrivateInheritanceOnly
@@ -272,6 +272,8 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
void PrivateAgain();
/* Single line block comments shouldn't break the parser */

void ShowThisPrivateOne() SIP_FORCE;

struct ProcessFeatureWrapper
{
QgsGeometrySnapper *instance = nullptr;

0 comments on commit 6e7b753

Please sign in to comment.