Skip to content
Permalink
Browse files
Add %Feature support to sipify
  • Loading branch information
m-kuhn committed Apr 2, 2017
1 parent 68d8108 commit a609883cc0df8b5213daeb90502c819ed533471f
@@ -31,6 +31,7 @@ class QgsProcessingProvider

virtual ~QgsProcessingProvider();

// QgsProcessingProvider &operator=( const QgsProcessingProvider &other ) = delete;

virtual QIcon icon() const;
%Docstring
@@ -33,6 +33,7 @@ class QgsProcessingRegistry : QObject

~QgsProcessingRegistry();

// QgsProcessingRegistry &operator=( const QgsProcessingRegistry &other ) = delete;

QList<QgsProcessingProvider *> providers() const;
%Docstring
@@ -337,6 +337,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator

virtual ~QgsVectorLayer();

// QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;

QString storageType() const;
%Docstring
@@ -53,6 +53,24 @@ sub processDoxygenLine
$line = readline $header;
#print $line;

if ($line =~ m/^\s*SIP_FEATURE\( (\w+) \)(.*)$/){
print "%Feature $1$2";
next;
}
if ($line =~ m/^\s*SIP_IF_FEATURE\( (\!?\w+) \)(.*)$/){
print "%If ($1)$2";
next;
}
if ($line =~ m/^\s*SIP_CONVERT_TO_SUBCLASS_CODE(.*)$/){
print "%ConvertToSubClassCode$1\n";
next;
}

if ($line =~ m/^\s*SIP_END(.*)$/){
print "%End$1";
next;
}

# Skip preprocessor stuff
if ($line =~ m/^\s*#/){
if ( $line =~ m/^\s*#ifdef SIP_RUN/){
@@ -165,6 +183,12 @@ sub processDoxygenLine
}
}

# Skip assignment operator
if ( $line =~ m/operator=\s*\(/ ){
print "// $line";

This comment has been minimized.

Copy link
@3nids

3nids Apr 3, 2017

Member

With SIP_SKIP the line is just not printed (rather than commented).
I think we should stay consistent and remove the line here.
Otherwise change the idea and print everything commented.

next;
}

# Detect comment block
if ($line =~ m/^\s*\/\*/){
do {no warnings 'uninitialized';
@@ -452,3 +452,23 @@ typedef unsigned long long qgssize;
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=keepreference#function-annotation-ReleaseGIL
*/
#define SIP_RELEASEGIL

/**
* Will insert a `%Feature feature` directive in sip files
*/
#define SIP_FEATURE(feature)

/**
* Will insert a `%If feature` directive in sip files
*/
#define SIP_IF_FEATURE(feature)

/**
* Convert to subclass code
*/
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)

/**
* Will insert a `%End` directive in sip files
*/
#define SIP_END
@@ -48,6 +48,13 @@ class QgsSipifyHeader : QtClass<QVariant>

%TypeHeaderCode
#include "sipifyheader.h"
%End

%ConvertToSubClassCode
if ( sipCpp->headerType() == QgsSipifyHeader::Special )
sipType = sipType_QgsSpecialSipifyHeader;
else
sipType = sipType_QgsStandardSipifyHeader;
%End
public:
enum MyEnum
@@ -80,6 +87,13 @@ A constructor with some special character types
QgsSipifyHeader();
%Docstring
Default constructor
%End

// QgsSipifyHeader &operator=( const QgsSipifyHeader other );

bool operator==( const QgsSipifyHeader other );
%Docstring
Comparison operator should be kept
%End

void multilineMethod( const QgsPoint &startPoint,
@@ -82,6 +82,16 @@ typedef QVector<QVariant> QgsSuperClass;
*/
class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private QgsBaseClass
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->headerType() == QgsSipifyHeader::Special )
sipType = sipType_QgsSpecialSipifyHeader;
else
sipType = sipType_QgsStandardSipifyHeader;
SIP_END
#endif

public:
//! This is an enum
enum MyEnum
@@ -114,6 +124,12 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private QgsBaseCla
//! Default constructor
QgsSipifyHeader() = default;

//! Assignment operator should be removed in sip
QgsSipifyHeader &operator=( const QgsSipifyHeader other );

//! Comparison operator should be kept
bool operator==( const QgsSipifyHeader other );

//! A multiline method signature
void multilineMethod( const QgsPoint &startPoint,
QgsFeatureId featureId,

0 comments on commit a609883

Please sign in to comment.