Skip to content

Commit

Permalink
reverse sipify override methods
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 23, 2017
1 parent 00fcc6e commit 8d2f42a
Show file tree
Hide file tree
Showing 38 changed files with 76 additions and 61 deletions.
17 changes: 12 additions & 5 deletions scripts/sipify_header.sh
Expand Up @@ -66,18 +66,25 @@ while read -r sipfile; do
dest_line=$(${GP}sed -r "s@/${annot_head[$i]}/@${annot_sip[$i]}@g" <<< $line)
esc_orig_line=$(${GP}sed -r 's/([(){}*+?$^&])/\\\1/g' <<< $orig_line)
esc_dest_line=$(${GP}sed -r 's/([&])/\\\1/g' <<< $dest_line)
esc_orig_line=$(${GP}sed -r 's/0/(0|nullptr)/g' <<< $esc_orig_line)
esc_orig_line=$(${GP}sed -r 's/0/(\?:0|nullptr)/g' <<< $esc_orig_line)
esc_orig_line=$(${GP}sed -r 's/""/(""|QString\(\))/g' <<< $esc_orig_line)
esc_dest_line=$(${GP}sed -r 's/(\*\w+) = 0/\1 = nullptr/g' <<< $esc_dest_line)
echo $esc_orig_line
echo $esc_dest_line
esc_orig_line=$(${GP}sed -r 's/((= 0)?;)/\(\\s\*override\)\?\\s\*\1/g' <<< $esc_orig_line)
esc_dest_line=$(${GP}sed -r 's/(( SIP_\w+)?( = 0)?;)/\\1\1/' <<< $esc_dest_line)
echo "orig: $esc_orig_line"
echo "dest: $esc_dest_line"
#echo "${GP}sed -i -r \"s/$esc_orig_line/$esc_dest_line/\" $header"
${GP}sed -i -r "s/$esc_orig_line/$esc_dest_line/" $header
perl -pi.bak -e "s/$esc_orig_line/$esc_dest_line/" $header
done < <(egrep "\/${annot_head[$i]}\/" python/$sipfile)
done

# if [[ $sipfile =~ core/diagram/qgshistogramdiagram.sip ]]; then
# exit
# fi


if ! cmp $header $m >/dev/null 2>&1; then
if ! grep -xq "#include \"qgis.h\"" $header; then
if ! egrep -xq "#include \"qgis(_sip)?.h\"" $header; then
gawk -i inplace '{print} /^#include/ && !n {print "#include \"qgis.h\""; n++}' $header
fi
fi
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/interpolation/DualEdgeTriangulation.h
Expand Up @@ -44,7 +44,7 @@ class ANALYSIS_EXPORT DualEdgeTriangulation: public Triangulation
virtual ~DualEdgeTriangulation();
void setDecorator( Triangulation *d ) {mDecorator = d;}
//! Adds a line (e.g. a break-, structure- or an isoline) to the triangulation. The class takes ownership of the line object and its points
void addLine( Line3D *line, bool breakline ) override;
void addLine( Line3D *line SIP_TRANSFER, bool breakline ) override;
//! Adds a point to the triangulation and returns the number of this point in case of success or -100 in case of failure
int addPoint( Point3D *p ) override;
//! Performs a consistency check, remove this later
Expand All @@ -63,7 +63,7 @@ class ANALYSIS_EXPORT DualEdgeTriangulation: public Triangulation
//! \note not available in Python bindings
virtual bool getTriangle( double x, double y, Point3D *p1, int *n1, Point3D *p2, int *n2, Point3D *p3, int *n3 ) override SIP_SKIP;
//! Finds out, in which triangle the point with coordinates x and y is and assigns addresses to the points at the vertices to 'p1', 'p2' and 'p3
virtual bool getTriangle( double x, double y, Point3D *p1, Point3D *p2, Point3D *p3 ) override;
virtual bool getTriangle( double x, double y, Point3D *p1 SIP_OUT, Point3D *p2 SIP_OUT, Point3D *p3 SIP_OUT ) override;
//! Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point. Four integer values describe a triangle, the first three are the number of the half edges of the triangle and the fourth is -10, if the third (and most counterclockwise) edge is a breakline, and -20 otherwise. The value list has to be deleted by the code which called the method
QList<int> *getSurroundingTriangles( int pointno ) override;
//! Returns the largest x-coordinate value of the bounding box
Expand Down
5 changes: 3 additions & 2 deletions src/analysis/interpolation/TriDecorator.h
Expand Up @@ -18,6 +18,7 @@
#define TRIDECORATOR_H

#include "Triangulation.h"
#include "qgis.h"
#include "qgis_analysis.h"

/** \ingroup analysis
Expand All @@ -38,8 +39,8 @@ class ANALYSIS_EXPORT TriDecorator : public Triangulation
virtual bool calcPoint( double x, double y, Point3D *result ) override;
virtual Point3D *getPoint( unsigned int i ) const override;
virtual int getNumberOfPoints() const override;
bool getTriangle( double x, double y, Point3D *p1, int *n1, Point3D *p2, int *n2, Point3D *p3, int *n3 ) override;
bool getTriangle( double x, double y, Point3D *p1, Point3D *p2, Point3D *p3 ) override;
bool getTriangle( double x, double y, Point3D *p1, int *n1 SIP_OUT, Point3D *p2 SIP_OUT, int *n2 SIP_OUT, Point3D *p3 SIP_OUT, int *n3 SIP_OUT ) override;
bool getTriangle( double x, double y, Point3D *p1 SIP_OUT, Point3D *p2 SIP_OUT, Point3D *p3 SIP_OUT ) override;
virtual int getOppositePoint( int p1, int p2 ) override;
virtual QList<int> *getSurroundingTriangles( int pointno ) override;
virtual double getXMax() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerattributetablev2.h
Expand Up @@ -90,7 +90,7 @@ class CORE_EXPORT QgsComposerAttributeTableV2: public QgsComposerTableV2
*/
virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ) override;

virtual void addFrame( QgsComposerFrame *frame, bool recalcFrameSizes = true ) override;
virtual void addFrame( QgsComposerFrame *frame SIP_TRANSFER, bool recalcFrameSizes = true ) override;

/** Sets the source for attributes to show in table body.
* \param source content source
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerhtml.h
Expand Up @@ -206,7 +206,7 @@ class CORE_EXPORT QgsComposerHtml: public QgsComposerMultiFrame
void render( QPainter *p, const QRectF &renderExtent, const int frameIndex ) override;
bool writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const override;
bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ) override;
void addFrame( QgsComposerFrame *frame, bool recalcFrameSizes = true ) override;
void addFrame( QgsComposerFrame *frame SIP_TRANSFER, bool recalcFrameSizes = true ) override;
//overridden to break frames without dividing lines of text
double findNearbyPageBreak( double yPos ) override;

Expand Down
3 changes: 2 additions & 1 deletion src/core/diagram/qgshistogramdiagram.h
Expand Up @@ -19,6 +19,7 @@
#define DIAGRAM_NAME_HISTOGRAM "Histogram"

#include "qgis_core.h"
#include "qgis.h"
#include "qgsdiagram.h"
#include <QPen>
#include <QBrush>
Expand All @@ -39,7 +40,7 @@ class CORE_EXPORT QgsHistogramDiagram: public QgsDiagram
public:
QgsHistogramDiagram();

virtual QgsHistogramDiagram *clone() const override;
virtual QgsHistogramDiagram *clone() const override SIP_FACTORY;

void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ) override;

Expand Down
3 changes: 2 additions & 1 deletion src/core/diagram/qgspiediagram.h
Expand Up @@ -18,6 +18,7 @@
#define DIAGRAM_NAME_PIE "Pie"

#include "qgis_core.h"
#include "qgis.h"
#include "qgsdiagram.h"
#include <QPen>
#include <QBrush>
Expand All @@ -37,7 +38,7 @@ class CORE_EXPORT QgsPieDiagram: public QgsDiagram
public:
QgsPieDiagram();

virtual QgsPieDiagram *clone() const override;
virtual QgsPieDiagram *clone() const override SIP_FACTORY;

void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ) override;

Expand Down
3 changes: 2 additions & 1 deletion src/core/diagram/qgstextdiagram.h
Expand Up @@ -18,6 +18,7 @@
#define DIAGRAM_NAME_TEXT "Text"

#include "qgis_core.h"
#include "qgis.h"
#include "qgsdiagram.h"
#include <QPen>
#include <QBrush>
Expand Down Expand Up @@ -49,7 +50,7 @@ class CORE_EXPORT QgsTextDiagram: public QgsDiagram
};

QgsTextDiagram();
virtual QgsTextDiagram *clone() const override;
virtual QgsTextDiagram *clone() const override SIP_FACTORY;

void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ) override;

Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgsblureffect.h
Expand Up @@ -53,7 +53,7 @@ class CORE_EXPORT QgsBlurEffect : public QgsPaintEffect
virtual QString type() const override { return QStringLiteral( "blur" ); }
virtual QgsStringMap properties() const override;
virtual void readProperties( const QgsStringMap &props ) override;
virtual QgsBlurEffect *clone() const override;
virtual QgsBlurEffect *clone() const override SIP_FACTORY;

/** Sets blur level (strength)
* \param level blur level. Depending on the current blurMethod(), this parameter
Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgscoloreffect.h
Expand Up @@ -47,7 +47,7 @@ class CORE_EXPORT QgsColorEffect : public QgsPaintEffect
virtual QString type() const override { return QStringLiteral( "color" ); }
virtual QgsStringMap properties() const override;
virtual void readProperties( const QgsStringMap &props ) override;
virtual QgsColorEffect *clone() const override;
virtual QgsColorEffect *clone() const override SIP_FACTORY;

/** Sets the brightness modification for the effect.
* \param brightness Valid values are between -255 and 255, where 0 represents
Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgseffectstack.h
Expand Up @@ -65,7 +65,7 @@ class CORE_EXPORT QgsEffectStack : public QgsPaintEffect
virtual ~QgsEffectStack();

virtual QString type() const override { return QStringLiteral( "effectStack" ); }
virtual QgsEffectStack *clone() const override;
virtual QgsEffectStack *clone() const override SIP_FACTORY;
virtual bool saveProperties( QDomDocument &doc, QDomElement &element ) const override;
virtual bool readProperties( const QDomElement &element ) override;

Expand Down
4 changes: 2 additions & 2 deletions src/core/effects/qgsgloweffect.h
Expand Up @@ -245,7 +245,7 @@ class CORE_EXPORT QgsOuterGlowEffect : public QgsGlowEffect
QgsOuterGlowEffect();

virtual QString type() const override { return QStringLiteral( "outerGlow" ); }
virtual QgsOuterGlowEffect *clone() const override;
virtual QgsOuterGlowEffect *clone() const override SIP_FACTORY;

protected:

Expand Down Expand Up @@ -275,7 +275,7 @@ class CORE_EXPORT QgsInnerGlowEffect : public QgsGlowEffect
QgsInnerGlowEffect();

virtual QString type() const override { return QStringLiteral( "innerGlow" ); }
virtual QgsInnerGlowEffect *clone() const override;
virtual QgsInnerGlowEffect *clone() const override SIP_FACTORY;

protected:

Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgspainteffect.h
Expand Up @@ -267,7 +267,7 @@ class CORE_EXPORT QgsDrawSourceEffect : public QgsPaintEffect
static QgsPaintEffect *create( const QgsStringMap &map ) SIP_FACTORY;

virtual QString type() const override { return QStringLiteral( "drawSource" ); }
virtual QgsDrawSourceEffect *clone() const override;
virtual QgsDrawSourceEffect *clone() const override SIP_FACTORY;
virtual QgsStringMap properties() const override;
virtual void readProperties( const QgsStringMap &props ) override;

Expand Down
4 changes: 2 additions & 2 deletions src/core/effects/qgsshadoweffect.h
Expand Up @@ -200,7 +200,7 @@ class CORE_EXPORT QgsDropShadowEffect : public QgsShadowEffect
QgsDropShadowEffect();

virtual QString type() const override;
virtual QgsDropShadowEffect *clone() const override;
virtual QgsDropShadowEffect *clone() const override SIP_FACTORY;

protected:

Expand Down Expand Up @@ -229,7 +229,7 @@ class CORE_EXPORT QgsInnerShadowEffect : public QgsShadowEffect
QgsInnerShadowEffect();

virtual QString type() const override;
virtual QgsInnerShadowEffect *clone() const override;
virtual QgsInnerShadowEffect *clone() const override SIP_FACTORY;

protected:

Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgstransformeffect.h
Expand Up @@ -48,7 +48,7 @@ class CORE_EXPORT QgsTransformEffect : public QgsPaintEffect
virtual QString type() const override { return QStringLiteral( "transform" ); }
virtual QgsStringMap properties() const override;
virtual void readProperties( const QgsStringMap &props ) override;
virtual QgsTransformEffect *clone() const override;
virtual QgsTransformEffect *clone() const override SIP_FACTORY;

/** Sets the transform x translation.
* \param translateX distance to translate along the x axis
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsdiagramrenderer.h
Expand Up @@ -632,7 +632,7 @@ class CORE_EXPORT QgsSingleCategoryDiagramRenderer : public QgsDiagramRenderer
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;

QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const override;
QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const override SIP_FACTORY;

protected:
bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const override;
Expand Down Expand Up @@ -699,7 +699,7 @@ class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer : public QgsDiagramRend
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;

QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const override;
QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const override SIP_FACTORY;

protected:
bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const override;
Expand Down
3 changes: 2 additions & 1 deletion src/core/raster/qgsbrightnesscontrastfilter.h
Expand Up @@ -19,6 +19,7 @@
#define QGSBRIGHTNESSCONTRASTFILTER_H

#include "qgis_core.h"
#include "qgis.h"
#include "qgsrasterinterface.h"

class QDomElement;
Expand All @@ -39,7 +40,7 @@ class CORE_EXPORT QgsBrightnessContrastFilter : public QgsRasterInterface

bool setInput( QgsRasterInterface *input ) override;

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;

void setBrightness( int brightness ) { mBrightness = qBound( -255, brightness, 255 ); }
int brightness() const { return mBrightness; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgscolorrampshader.h
Expand Up @@ -149,7 +149,7 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
bool shade( double, double, double, double, int *, int *, int *, int * ) override;

//! \brief Get symbology items if provided by renderer
void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const override;
void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const override;

//! Sets classification mode
void setClassificationMode( ClassificationMode classificationMode ) { mClassificationMode = classificationMode; }
Expand Down
3 changes: 2 additions & 1 deletion src/core/raster/qgshuesaturationfilter.h
Expand Up @@ -19,6 +19,7 @@
#define QGSHUESATURATIONFILTER_H

#include "qgis_core.h"
#include "qgis.h"
#include "qgsrasterinterface.h"

class QDomElement;
Expand Down Expand Up @@ -49,7 +50,7 @@ class CORE_EXPORT QgsHueSaturationFilter : public QgsRasterInterface

bool setInput( QgsRasterInterface *input ) override;

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;

void setSaturation( int saturation );
int saturation() const { return mSaturation; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsmultibandcolorrenderer.h
Expand Up @@ -45,7 +45,7 @@ class CORE_EXPORT QgsMultiBandColorRenderer: public QgsRasterRenderer

static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input );

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;

int redBand() const { return mRedBand; }
void setRedBand( int band ) { mRedBand = band; }
Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgspalettedrasterrenderer.h
Expand Up @@ -70,7 +70,7 @@ class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
QgsPalettedRasterRenderer *clone() const override;
static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;

//! Returns number of colors
int nColors() const { return mClassData.size(); }
Expand All @@ -90,7 +90,7 @@ class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer

void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;

void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const override;
void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const override;

QList<int> usesBands() const override;

Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterlayer.h
Expand Up @@ -269,7 +269,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
* \since QGIS 2.4
*/
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override;
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;

//! \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap
void draw( QPainter *theQPainter,
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterresamplefilter.h
Expand Up @@ -41,7 +41,7 @@ class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface

bool setInput( QgsRasterInterface *input ) override;

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;

//! Set resampler for zoomed in scales. Takes ownership of the object
void setZoomedInResampler( QgsRasterResampler *r SIP_TRANSFER );
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgssinglebandgrayrenderer.h
Expand Up @@ -62,7 +62,7 @@ class CORE_EXPORT QgsSingleBandGrayRenderer: public QgsRasterRenderer

void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;

void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const override;
void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const override;

QList<int> usesBands() const override;

Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgssinglebandpseudocolorrenderer.h
Expand Up @@ -71,7 +71,7 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer

void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;

void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const override;
void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const override;

QList<int> usesBands() const override;

Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsarrowsymbollayer.h
Expand Up @@ -42,9 +42,9 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayer
*/
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;

virtual QgsArrowSymbolLayer *clone() const override;
virtual QgsArrowSymbolLayer *clone() const override SIP_FACTORY;
virtual QgsSymbol *subSymbol() override { return mSymbol.get(); }
virtual bool setSubSymbol( QgsSymbol *symbol ) override;
virtual bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;

//! Get current arrow width
Expand Down

0 comments on commit 8d2f42a

Please sign in to comment.