Skip to content

Commit

Permalink
sipify_all
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Apr 7, 2017
1 parent ebc1afe commit 58d2d6d
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 41 deletions.
1 change: 0 additions & 1 deletion python/core/annotations/qgsannotationmanager.sip
Expand Up @@ -28,7 +28,6 @@ class QgsAnnotationManager : QObject
%TypeHeaderCode
#include "qgsannotationmanager.h"
%End

public:

explicit QgsAnnotationManager( QgsProject *project /TransferThis/ = 0 );
Expand Down
1 change: 0 additions & 1 deletion python/core/annotations/qgssvgannotation.sip
Expand Up @@ -19,7 +19,6 @@ class QgsSvgAnnotation: QgsAnnotation
%TypeHeaderCode
#include "qgssvgannotation.h"
%End

public:

QgsSvgAnnotation( QObject *parent /TransferThis/ = 0 );
Expand Down
1 change: 0 additions & 1 deletion python/core/annotations/qgstextannotation.sip
Expand Up @@ -19,7 +19,6 @@ class QgsTextAnnotation: QgsAnnotation
%TypeHeaderCode
#include "qgstextannotation.h"
%End

public:

QgsTextAnnotation( QObject *parent /TransferThis/ = 0 );
Expand Down
1 change: 0 additions & 1 deletion python/core/processing/qgsprocessingfeedback.sip
Expand Up @@ -23,7 +23,6 @@ class QgsProcessingFeedback : QgsFeedback
%TypeHeaderCode
#include "qgsprocessingfeedback.h"
%End

public:

virtual void setProgressText( const QString &text );
Expand Down
1 change: 0 additions & 1 deletion python/core/processing/qgsprocessingprovider.sip
Expand Up @@ -21,7 +21,6 @@ class QgsProcessingProvider : QObject
%TypeHeaderCode
#include "qgsprocessingprovider.h"
%End

public:

QgsProcessingProvider( QObject *parent /TransferThis/ = 0 );
Expand Down
1 change: 0 additions & 1 deletion python/core/processing/qgsprocessingregistry.sip
Expand Up @@ -23,7 +23,6 @@ class QgsProcessingRegistry : QObject
%TypeHeaderCode
#include "qgsprocessingregistry.h"
%End

public:

QgsProcessingRegistry( QObject *parent /TransferThis/ = 0 );
Expand Down
1 change: 0 additions & 1 deletion python/core/processing/qgsprocessingutils.sip
Expand Up @@ -22,7 +22,6 @@ class QgsProcessingUtils
%TypeHeaderCode
#include "qgsprocessingutils.h"
%End

public:

static QList< QgsRasterLayer * > compatibleRasterLayers( QgsProject *project, bool sort = true );
Expand Down
1 change: 0 additions & 1 deletion python/core/qgsactionscoperegistry.sip
Expand Up @@ -27,7 +27,6 @@ class QgsActionScopeRegistry : QObject
%TypeHeaderCode
#include "qgsactionscoperegistry.h"
%End

public:

explicit QgsActionScopeRegistry( QObject *parent = 0 );
Expand Down
10 changes: 5 additions & 5 deletions python/core/qgsaggregatecalculator.sip
Expand Up @@ -15,7 +15,7 @@ class QgsAggregateCalculator
{
%Docstring
Utility class for calculating aggregates for a field (or expression) over the features
from a vector layer. It is recommended that QgsVectorLayer::aggregate() is used rather then
from a vector layer. It is recommended that QgsVectorLayer.aggregate() is used rather then
directly using this class, as the QgsVectorLayer method can handle delegating aggregate calculation
to a data provider for remote calculation.
.. versionadded:: 2.16
Expand Down Expand Up @@ -57,15 +57,15 @@ class QgsAggregateCalculator
%Docstring
Optional filter for calculating aggregate over a subset of features, or an
empty string to use all features.
\see QgsAggregateCalculator::setFilter()
\see QgsAggregateCalculator::filter()
\see QgsAggregateCalculator.setFilter()
\see QgsAggregateCalculator.filter()
%End

QString delimiter;
%Docstring
Delimiter to use for joining values with the StringConcatenate aggregate.
\see QgsAggregateCalculator::setDelimiter()
\see QgsAggregateCalculator::delimiter()
\see QgsAggregateCalculator.setDelimiter()
\see QgsAggregateCalculator.delimiter()
%End
};

Expand Down
1 change: 0 additions & 1 deletion python/core/qgsattributeeditorelement.sip
Expand Up @@ -15,7 +15,6 @@ class QgsAttributeEditorElement /Abstract/
%TypeHeaderCode
#include "qgsattributeeditorelement.h"
%End

%ConvertToSubClassCode
switch ( sipCpp->type() )
{
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsattributetableconfig.sip
Expand Up @@ -31,7 +31,7 @@ class QgsAttributeTableConfig
Constructor for ColumnConfig
%End

bool operator== ( const ColumnConfig &other ) const;
bool operator== ( const QgsAttributeTableConfig::ColumnConfig &other ) const;

QgsAttributeTableConfig::Type type; //!< The type of this column.
QString name; //!< The name of the attribute if this column represents a field
Expand Down
2 changes: 0 additions & 2 deletions python/core/qgsfeature.sip
Expand Up @@ -33,8 +33,6 @@ class QgsFeature
#define sipType_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant))
#endif
%End


public:

SIP_PYOBJECT __iter__();
Expand Down
3 changes: 1 addition & 2 deletions python/core/qgspropertytransformer.sip
Expand Up @@ -125,7 +125,7 @@ class QgsPropertyTransformer
%TypeHeaderCode
#include "qgspropertytransformer.h"
%End

private:
%ConvertToSubClassCode
if ( sipCpp->transformerType() == QgsPropertyTransformer::GenericNumericTransformer )
sipType = sipType_QgsGenericNumericTransformer;
Expand All @@ -136,7 +136,6 @@ class QgsPropertyTransformer
else
sipType = sipType_QgsPropertyTransformer;
%End

public:

enum Type
Expand Down
2 changes: 0 additions & 2 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -297,8 +297,6 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
%TypeHeaderCode
#include "qgsvectorlayer.h"
%End


public:

enum EditResult
Expand Down
1 change: 0 additions & 1 deletion python/core/raster/qgsrasterfilewritertask.sip
Expand Up @@ -22,7 +22,6 @@ class QgsRasterFileWriterTask : QgsTask
%TypeHeaderCode
#include "qgsrasterfilewritertask.h"
%End

public:

QgsRasterFileWriterTask( const QgsRasterFileWriter &writer, QgsRasterPipe *pipe /Transfer/,
Expand Down
1 change: 0 additions & 1 deletion python/gui/symbology-ng/characterwidget.sip
Expand Up @@ -20,7 +20,6 @@ class CharacterWidget : QWidget
%TypeHeaderCode
#include "characterwidget.h"
%End

public:

CharacterWidget( QWidget *parent /TransferThis/ = 0 );
Expand Down
44 changes: 27 additions & 17 deletions scripts/sipify.pl
Expand Up @@ -3,6 +3,10 @@
use warnings;
use File::Basename;

use constant PRIVATE => 0;
use constant PROTECTED => 1;
use constant PUBLIC => 2;

# TODO add contexts for
# "multiline function signatures"
# docustrings for QgsFeature::QgsAttributes
Expand Down Expand Up @@ -40,7 +44,7 @@ sub processDoxygenLine
# contexts
my $SIP_RUN = 0;
my $HEADER_CODE = 0;
my $PRIVATE_SECTION = 0;
my $ACCESS = PUBLIC;
my $MULTILINE_DEFINITION = 0;

my $comment = '';
Expand Down Expand Up @@ -85,8 +89,8 @@ sub processDoxygenLine
if ($line =~ m/^\s*#/){
if ( $line =~ m/^\s*#ifdef SIP_RUN/){
$SIP_RUN = 1;
if ($PRIVATE_SECTION == 1){
print $private_section_line;
if ($ACCESS == PRIVATE){
print $private_section_line
}
next;
}
Expand Down Expand Up @@ -133,7 +137,7 @@ sub processDoxygenLine
}
elsif ( $line =~ m/^\s*#else/ && $nesting_index == 0 ){
# code here will be printed out
if ($PRIVATE_SECTION == 1){
if ($ACCESS == PRIVATE){
print $private_section_line;
}
$SIP_RUN = 1;
Expand Down Expand Up @@ -178,21 +182,22 @@ sub processDoxygenLine

# Private members (exclude SIP_RUN)
if ( $line =~ m/^\s*private( slots)?:/ ){
$PRIVATE_SECTION = 1;
$ACCESS = PRIVATE;
$private_section_line = $line;
next;
}
if ( $PRIVATE_SECTION == 1 ){
if ( $SIP_RUN == 0){
if ( $line =~ m/^\s*(public|protected)( slots)?:.*$/ || $line =~ m/^\};.*$/){
$PRIVATE_SECTION = 0;
}
else {
next;
}
}
elsif ( $line =~ m/^\s*(public)( slots)?:.*$/ ){
$ACCESS = PUBLIC;
}
elsif ( $line =~ m/^\};.*$/ ) {
$ACCESS = PUBLIC;
}
elsif ( $line =~ m/^\s*(protected)( slots)?:.*$/ ){
$ACCESS = PROTECTED;
}
elsif ( $ACCESS == PRIVATE && $SIP_RUN == 0 ) {
next;
}

# Skip assignment operator
if ( $line =~ m/operator=\s*\(/ ){
print "// $line";
Expand Down Expand Up @@ -226,6 +231,10 @@ sub processDoxygenLine
}
}

if ( $line =~ m/^(\s*struct)\s+(\w+)$/ ) {
$ACCESS = PUBLIC;
}

# class declaration started
if ( $line =~ m/^(\s*class)\s*([A-Z]+_EXPORT)?\s+(\w+)(\s*\:.*)?(\s*SIP_ABSTRACT)?$/ ){
do {no warnings 'uninitialized';
Expand Down Expand Up @@ -260,6 +269,7 @@ sub processDoxygenLine

$comment = '';
$HEADER_CODE = 1;
$ACCESS = PRIVATE;
next;
}

Expand All @@ -282,8 +292,8 @@ sub processDoxygenLine
next;
}

# skip non-method member declaration (e.g. in protected sections)
if ( $SIP_RUN != 1 && $line =~ m/^\s*\w+(::\w+)? \*?\w+( = \w+(\([^()]+\))?)?;/){
# skip non-method member declaration (in non-public sections)
if ( $SIP_RUN != 1 && $ACCESS != PUBLIC && $line =~ m/^\s*\w+(::\w+)? \*?\w+( = \w+(\([^()]+\))?)?;/){
next;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsattributetableconfig.h
Expand Up @@ -56,7 +56,7 @@ class CORE_EXPORT QgsAttributeTableConfig
, width( -1 )
{}

bool operator== ( const ColumnConfig &other ) const;
bool operator== ( const QgsAttributeTableConfig::ColumnConfig &other ) const;

QgsAttributeTableConfig::Type type; //!< The type of this column.
QString name; //!< The name of the attribute if this column represents a field
Expand Down

0 comments on commit 58d2d6d

Please sign in to comment.