Skip to content

Commit 5e220e6

Browse files
committedApr 30, 2017
followup b46de90
1 parent 7f3941e commit 5e220e6

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
 

‎scripts/sipify.pl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,11 @@ sub remove_constructor_or_body {
569569
$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
570570

571571
# combine multiple annotations
572-
dbg_info("combine multiple annotations -- works only for 2");
573572
# https://regex101.com/r/uvCt4M/1
574-
$line =~ s/\/(\w+(=\w+)?)\/\s*\/(\w+(=\w+)?)\/\s*;(\s*(\/\/.*)?)$/\/$1,$3\/$5;/;
573+
do {no warnings 'uninitialized';
574+
$line =~ s/\/(\w+(=\w+)?)\/\s*\/(\w+(=\w+)?)\/\s*;(\s*(\/\/.*)?)$/\/$1,$3\/$5;/;
575+
($3 == undef) or dbg_info("combine multiple annotations -- works only for 2");
576+
};
575577

576578
# unprinted annotations
577579
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYARGTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
@@ -657,14 +659,17 @@ sub remove_constructor_or_body {
657659
next;
658660
}
659661
elsif ( $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / || $line =~ m/operator\[\]\(/ ){
662+
dbg_info('skipping comment');
660663
$comment = '';
664+
$return_type = '';
661665
}
662666
elsif ( $comment !~ m/^\s*$/ || $return_type ne ''){
663667
if ( $is_override == 1 && $comment =~ m/^\s*$/ ){
664668
# overridden method with no new docs - so don't create a Docstring and use
665669
# parent class Docstring
666670
}
667671
else {
672+
dbg_info('writing comment');
668673
push @output, dbg("CM1")."%Docstring\n";
669674
if ( $comment !~ m/^\s*$/ ){
670675
push @output, dbg("CM2")."$comment\n";

‎tests/scripts/sipifyheader.expected.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ remove argument
305305
void position( bool keep, bool keep );
306306
void position( bool keep );
307307

308+
Whatever &operator[]( int i ) /Factory/;
309+
%MethodCode
310+
....
311+
%End
312+
308313
void ZshouldBeShown();
309314

310315
void methodCodeWithMultiLineDef();

‎tests/scripts/sipifyheader.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,14 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
329329
void position( bool keep, bool middle_remove SIP_PYARGREMOVE, bool keep );
330330
void position( bool keep, bool last_remove SIP_PYARGREMOVE );
331331

332+
//! Some comment
333+
Whatever &operator[]( int i ) SIP_FACTORY;
334+
#ifdef SIP_RUN
335+
%MethodCode
336+
....
337+
%End
338+
#endif
339+
332340
#if 0
333341
#if Whatever
334342
void X();

0 commit comments

Comments
 (0)
Please sign in to comment.