followup b46de90d53c9298ba4f1267d2bdabcf4d669afe5

This commit is contained in:
Denis Rouzaud 2017-05-01 00:13:26 +02:00
parent 7f3941e073
commit 5e220e69ec
3 changed files with 20 additions and 2 deletions

View File

@ -569,9 +569,11 @@ while ($line_idx < $line_count){
$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
# combine multiple annotations
dbg_info("combine multiple annotations -- works only for 2");
# https://regex101.com/r/uvCt4M/1
$line =~ s/\/(\w+(=\w+)?)\/\s*\/(\w+(=\w+)?)\/\s*;(\s*(\/\/.*)?)$/\/$1,$3\/$5;/;
do {no warnings 'uninitialized';
$line =~ s/\/(\w+(=\w+)?)\/\s*\/(\w+(=\w+)?)\/\s*;(\s*(\/\/.*)?)$/\/$1,$3\/$5;/;
($3 == undef) or dbg_info("combine multiple annotations -- works only for 2");
};
# unprinted annotations
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYARGTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
@ -657,7 +659,9 @@ while ($line_idx < $line_count){
next;
}
elsif ( $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / || $line =~ m/operator\[\]\(/ ){
dbg_info('skipping comment');
$comment = '';
$return_type = '';
}
elsif ( $comment !~ m/^\s*$/ || $return_type ne ''){
if ( $is_override == 1 && $comment =~ m/^\s*$/ ){
@ -665,6 +669,7 @@ while ($line_idx < $line_count){
# parent class Docstring
}
else {
dbg_info('writing comment');
push @output, dbg("CM1")."%Docstring\n";
if ( $comment !~ m/^\s*$/ ){
push @output, dbg("CM2")."$comment\n";

View File

@ -305,6 +305,11 @@ remove argument
void position( bool keep, bool keep );
void position( bool keep );
Whatever &operator[]( int i ) /Factory/;
%MethodCode
....
%End
void ZshouldBeShown();
void methodCodeWithMultiLineDef();

View File

@ -329,6 +329,14 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
void position( bool keep, bool middle_remove SIP_PYARGREMOVE, bool keep );
void position( bool keep, bool last_remove SIP_PYARGREMOVE );
//! Some comment
Whatever &operator[]( int i ) SIP_FACTORY;
#ifdef SIP_RUN
%MethodCode
....
%End
#endif
#if 0
#if Whatever
void X();