mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
sipify improvements
* reset comment while changing section * fix comment at the end of a comment block * use SIP_FORCE to show private members
This commit is contained in:
parent
68e0a62716
commit
6e7b753ceb
@ -127,6 +127,7 @@ while ($line_idx < $line_count){
|
||||
}
|
||||
elsif ( $line =~ m/^\s*#endif/ ){
|
||||
if ( $nesting_index == 0 ){
|
||||
$comment = '';
|
||||
$SIP_RUN = 0;
|
||||
last;
|
||||
}
|
||||
@ -156,6 +157,7 @@ while ($line_idx < $line_count){
|
||||
}
|
||||
elsif ( $line =~ m/^\s*#endif/ ){
|
||||
if ( $nesting_index == 0 ){
|
||||
$comment = '';
|
||||
$SIP_RUN = 0;
|
||||
last;
|
||||
}
|
||||
@ -205,18 +207,26 @@ while ($line_idx < $line_count){
|
||||
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 @@ while ($line_idx < $line_count){
|
||||
$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 @@ while ($line_idx < $line_count){
|
||||
$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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user