mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-05 00:04:40 -05:00
[sipify] fix Abstract class
unblacklist qgstransaction.sip (followup 931bf32a9fe46570ac80d947552d46c9f427457) also fix method declaration with private only inheritance
This commit is contained in:
parent
a88cf7ad31
commit
bfb62c4be9
@ -2049,26 +2049,25 @@ PREDEFINED =
|
|||||||
# definition found in the source code.
|
# definition found in the source code.
|
||||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||||
|
|
||||||
EXPAND_AS_DEFINED = "SIP_TRANSFER" \
|
EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
|
||||||
"SIP_PYNAME" \
|
|
||||||
"SIP_OUT" \
|
|
||||||
"SIP_INOUT" \
|
|
||||||
"SIP_TRANSFERTHIS" \
|
|
||||||
"SIP_TRANSFERBACK" \
|
|
||||||
"SIP_FACTORY" \
|
|
||||||
"SIP_KEEPREFERENCE" \
|
|
||||||
"SIP_ARRAY" \
|
"SIP_ARRAY" \
|
||||||
"SIP_ARRAYSIZE" \
|
"SIP_ARRAYSIZE" \
|
||||||
"SIP_PYNAME" \
|
|
||||||
"SIP_SKIP" \
|
|
||||||
"SIP_PYARGDEFAULT" \
|
|
||||||
"SIP_PYTYPE" \
|
|
||||||
"SIP_PYARGREMOVE" \
|
|
||||||
"SIP_CONVERT_TO_SUBCLASS_CODE" \
|
"SIP_CONVERT_TO_SUBCLASS_CODE" \
|
||||||
|
"SIP_END" \
|
||||||
|
"SIP_FACTORY" \
|
||||||
"SIP_FEATURE" \
|
"SIP_FEATURE" \
|
||||||
"SIP_IF_FEATURE" \
|
"SIP_IF_FEATURE" \
|
||||||
"SIP_END" \
|
"SIP_INOUT" \
|
||||||
"SIP_ABSTRACT"
|
"SIP_KEEPREFERENCE" \
|
||||||
|
"SIP_OUT" \
|
||||||
|
"SIP_PYARGDEFAULT" \
|
||||||
|
"SIP_PYARGREMOVE" \
|
||||||
|
"SIP_PYNAME" \
|
||||||
|
"SIP_PYTYPE" \
|
||||||
|
"SIP_SKIP" \
|
||||||
|
"SIP_TRANSFER" \
|
||||||
|
"SIP_TRANSFERBACK" \
|
||||||
|
"SIP_TRANSFERTHIS"
|
||||||
|
|
||||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||||
# remove all references to function-like macros that are alone on a line, have
|
# remove all references to function-like macros that are alone on a line, have
|
||||||
|
|||||||
@ -13,7 +13,6 @@ core/qgsfeaturerequest.sip
|
|||||||
core/qgsgeometrysimplifier.sip
|
core/qgsgeometrysimplifier.sip
|
||||||
core/qgsgeometryvalidator.sip
|
core/qgsgeometryvalidator.sip
|
||||||
core/qgsmaptopixelgeometrysimplifier.sip
|
core/qgsmaptopixelgeometrysimplifier.sip
|
||||||
core/qgstransaction.sip
|
|
||||||
core/qgstransactiongroup.sip
|
core/qgstransactiongroup.sip
|
||||||
core/qgsdartmeasurement.sip
|
core/qgsdartmeasurement.sip
|
||||||
core/qgsexpressionfieldbuffer.sip
|
core/qgsexpressionfieldbuffer.sip
|
||||||
|
|||||||
@ -127,6 +127,54 @@ sub remove_constructor_or_body {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub fix_annotations(){
|
||||||
|
# printed annotations
|
||||||
|
$line =~ s/\bSIP_ABSTRACT\b/\/Abstract\//;
|
||||||
|
$line =~ s/\bSIP_ARRAY\b/\/Array\//;
|
||||||
|
$line =~ s/\bSIP_ARRAYSIZE\b/\/ArraySize\//;
|
||||||
|
$line =~ s/\bSIP_FACTORY\b/\/Factory\//;
|
||||||
|
$line =~ s/\bSIP_IN\b/\/In\//g;
|
||||||
|
$line =~ s/\bSIP_INOUT\b/\/In,Out\//g;
|
||||||
|
$line =~ s/\bSIP_KEEPREFERENCE\b/\/KeepReference\//;
|
||||||
|
$line =~ s/\bSIP_OUT\b/\/Out\//g;
|
||||||
|
$line =~ s/\bSIP_RELEASEGIL\b/\/ReleaseGIL\//;
|
||||||
|
$line =~ s/\bSIP_TRANSFER\b/\/Transfer\//g;
|
||||||
|
$line =~ s/\bSIP_TRANSFERBACK\b/\/TransferBack\//;
|
||||||
|
$line =~ s/\bSIP_TRANSFERTHIS\b/\/TransferThis\//;
|
||||||
|
|
||||||
|
$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
|
||||||
|
|
||||||
|
# combine multiple annotations
|
||||||
|
# https://regex101.com/r/uvCt4M/3
|
||||||
|
do {no warnings 'uninitialized';
|
||||||
|
$line =~ s/\/(\w+(=\w+)?)\/\s*\/(\w+(=\w+)?)\//\/$1,$3\//;
|
||||||
|
(! $3) or dbg_info("combine multiple annotations -- works only for 2");
|
||||||
|
};
|
||||||
|
|
||||||
|
# unprinted annotations
|
||||||
|
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
|
||||||
|
$line =~ s/=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;
|
||||||
|
# remove argument
|
||||||
|
if ($line =~ m/SIP_PYARGREMOVE/){
|
||||||
|
if ( $MULTILINE_DEFINITION == 1 ){
|
||||||
|
my $prev_line = pop(@output) =~ s/\n$//r;
|
||||||
|
# update multi line status
|
||||||
|
my $parenthesis_balance = 0;
|
||||||
|
$parenthesis_balance += $prev_line =~ tr/\(//;
|
||||||
|
$parenthesis_balance -= $prev_line =~ tr/\)//;
|
||||||
|
if ($parenthesis_balance == 1){
|
||||||
|
$MULTILINE_DEFINITION = 0;
|
||||||
|
}
|
||||||
|
# concat with above line to bring previous commas
|
||||||
|
$line =~ s/^\s+//;
|
||||||
|
$line = "$prev_line $line\n";
|
||||||
|
}
|
||||||
|
# see https://regex101.com/r/5iNptO/4
|
||||||
|
$line =~ s/(?<coma>, +)?(const )?(\w+)(\<(?>[^<>]|(?4))*\>)? [\w&*]+ SIP_PYARGREMOVE( = [^()]*(\(\s*(?:[^()]++|(?6))*\s*\))?)?(?(<coma>)|,?)//g;
|
||||||
|
}
|
||||||
|
$line =~ s/SIP_FORCE//;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# main loop
|
# main loop
|
||||||
while ($line_idx < $line_count){
|
while ($line_idx < $line_count){
|
||||||
@ -388,7 +436,8 @@ while ($line_idx < $line_count){
|
|||||||
}
|
}
|
||||||
|
|
||||||
# class declaration started
|
# class declaration started
|
||||||
if ( $line =~ m/^(\s*class)\s*([A-Z]+_EXPORT)?\s+(\w+)(\s*\:.*)?(\s*SIP_ABSTRACT)?$/ ){
|
# https://regex101.com/r/6FWntP/2
|
||||||
|
if ( $line =~ m/^(\s*class)\s+([A-Z]+_EXPORT)?\s+(\w+)(\s*\:\s*(public|private)\s+\w+(<\w+>)?(::\w+(<\w+>)?)*(,\s*(public|private)\s+\w+(<\w+>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*SIP_.*)?$/ ){
|
||||||
dbg_info("class definition started => private");
|
dbg_info("class definition started => private");
|
||||||
push @ACCESS, PRIVATE;
|
push @ACCESS, PRIVATE;
|
||||||
push @global_bracket_nesting_index, 0;
|
push @global_bracket_nesting_index, 0;
|
||||||
@ -401,12 +450,14 @@ while ($line_idx < $line_count){
|
|||||||
if ($4){
|
if ($4){
|
||||||
my $m = $4;
|
my $m = $4;
|
||||||
$m =~ s/public //g;
|
$m =~ s/public //g;
|
||||||
$m =~ s/,?\s*private \w+(::\w+)?//;
|
$m =~ s/[,:]?\s*private \w+(::\w+)?//;
|
||||||
$m =~ s/(\s*:)?\s*$//;
|
$m =~ s/(\s*:)?\s*$//;
|
||||||
$line .= $m;
|
$line .= $m;
|
||||||
}
|
}
|
||||||
if ($5) {
|
if (defined $+{annot})
|
||||||
$line .= ' /Abstract/';
|
{
|
||||||
|
$line .= "$+{annot}";
|
||||||
|
fix_annotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
$line .= "\n{\n";
|
$line .= "\n{\n";
|
||||||
@ -559,49 +610,7 @@ while ($line_idx < $line_count){
|
|||||||
# remove export macro from struct definition
|
# remove export macro from struct definition
|
||||||
$line =~ s/^(\s*struct )\w+_EXPORT (.+)$/$1$2/;
|
$line =~ s/^(\s*struct )\w+_EXPORT (.+)$/$1$2/;
|
||||||
|
|
||||||
# printed annotations
|
fix_annotations();
|
||||||
$line =~ s/\bSIP_FACTORY\b/\/Factory\//;
|
|
||||||
$line =~ s/\bSIP_OUT\b/\/Out\//g;
|
|
||||||
$line =~ s/\bSIP_IN\b/\/In\//g;
|
|
||||||
$line =~ s/\bSIP_INOUT\b/\/In,Out\//g;
|
|
||||||
$line =~ s/\bSIP_TRANSFER\b/\/Transfer\//g;
|
|
||||||
$line =~ s/\bSIP_KEEPREFERENCE\b/\/KeepReference\//;
|
|
||||||
$line =~ s/\bSIP_TRANSFERTHIS\b/\/TransferThis\//;
|
|
||||||
$line =~ s/\bSIP_TRANSFERBACK\b/\/TransferBack\//;
|
|
||||||
$line =~ s/\bSIP_RELEASEGIL\b/\/ReleaseGIL\//;
|
|
||||||
$line =~ s/\bSIP_ARRAY\b/\/Array\//;
|
|
||||||
$line =~ s/\bSIP_ARRAYSIZE\b/\/ArraySize\//;
|
|
||||||
$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
|
|
||||||
|
|
||||||
# combine multiple annotations
|
|
||||||
# https://regex101.com/r/uvCt4M/3
|
|
||||||
do {no warnings 'uninitialized';
|
|
||||||
$line =~ s/\/(\w+(=\w+)?)\/\s*\/(\w+(=\w+)?)\//\/$1,$3\//;
|
|
||||||
(! $3) or dbg_info("combine multiple annotations -- works only for 2");
|
|
||||||
};
|
|
||||||
|
|
||||||
# unprinted annotations
|
|
||||||
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
|
|
||||||
$line =~ s/=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;
|
|
||||||
# remove argument
|
|
||||||
if ($line =~ m/SIP_PYARGREMOVE/){
|
|
||||||
if ( $MULTILINE_DEFINITION == 1 ){
|
|
||||||
my $prev_line = pop(@output) =~ s/\n$//r;
|
|
||||||
# update multi line status
|
|
||||||
my $parenthesis_balance = 0;
|
|
||||||
$parenthesis_balance += $prev_line =~ tr/\(//;
|
|
||||||
$parenthesis_balance -= $prev_line =~ tr/\)//;
|
|
||||||
if ($parenthesis_balance == 1){
|
|
||||||
$MULTILINE_DEFINITION = 0;
|
|
||||||
}
|
|
||||||
# concat with above line to bring previous commas
|
|
||||||
$line =~ s/^\s+//;
|
|
||||||
$line = "$prev_line $line\n";
|
|
||||||
}
|
|
||||||
# see https://regex101.com/r/5iNptO/4
|
|
||||||
$line =~ s/(?<coma>, +)?(const )?(\w+)(\<(?>[^<>]|(?4))*\>)? [\w&*]+ SIP_PYARGREMOVE( = [^()]*(\(\s*(?:[^()]++|(?6))*\s*\))?)?(?(<coma>)|,?)//g;
|
|
||||||
}
|
|
||||||
$line =~ s/SIP_FORCE//;
|
|
||||||
|
|
||||||
# fix astyle placing space after % character
|
# fix astyle placing space after % character
|
||||||
$line =~ s/\s*% (MappedType|TypeCode|TypeHeaderCode|ModuleHeaderCode|ConvertFromTypeCode|ConvertToTypeCode|MethodCode|End)/%$1/;
|
$line =~ s/\s*% (MappedType|TypeCode|TypeHeaderCode|ModuleHeaderCode|ConvertFromTypeCode|ConvertToTypeCode|MethodCode|End)/%$1/;
|
||||||
|
|||||||
@ -354,7 +354,7 @@ remove argument
|
|||||||
void ShowThisPrivateOne() ;
|
void ShowThisPrivateOne() ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClassWithPrivateInheritanceOnly
|
class ClassWithPrivateInheritanceOnly /Abstract/
|
||||||
{
|
{
|
||||||
%Docstring
|
%Docstring
|
||||||
Documentation goes here
|
Documentation goes here
|
||||||
|
|||||||
@ -422,7 +422,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
|
|||||||
* \ingroup core
|
* \ingroup core
|
||||||
* Documentation goes here
|
* Documentation goes here
|
||||||
*/
|
*/
|
||||||
class CORE_EXPORT ClassWithPrivateInheritanceOnly : private QgsBaseClass
|
class CORE_EXPORT ClassWithPrivateInheritanceOnly : private QgsBaseClass SIP_ABSTRACT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! A constructor with definition in header on several lines
|
//! A constructor with definition in header on several lines
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user