Skip to content
Permalink
Browse files

[sip] more reverse engineering

  • Loading branch information
3nids committed May 23, 2017
1 parent fe9594f commit 2929f9d693677145e8878c55bda6da2def46f88e
Showing with 102 additions and 85 deletions.
  1. +9 −7 scripts/sipify_header.sh
  2. +2 −2 src/core/effects/qgspainteffectregistry.h
  3. +3 −3 src/core/qgsdiagramrenderer.h
  4. +2 −1 src/core/raster/qgsbilinearrasterresampler.h
  5. +1 −1 src/core/raster/qgsbrightnesscontrastfilter.h
  6. +2 −1 src/core/raster/qgscubicrasterresampler.h
  7. +1 −1 src/core/raster/qgshillshaderenderer.h
  8. +1 −1 src/core/raster/qgshuesaturationfilter.h
  9. +1 −1 src/core/raster/qgsmultibandcolorrenderer.h
  10. +1 −1 src/core/raster/qgspalettedrasterrenderer.h
  11. +1 −1 src/core/raster/qgsrasterdataprovider.h
  12. +1 −1 src/core/raster/qgsrasterlayer.h
  13. +2 −1 src/core/raster/qgsrasternuller.h
  14. +2 −1 src/core/raster/qgsrasterprojector.h
  15. +2 −1 src/core/raster/qgsrasterrenderer.h
  16. +1 −1 src/core/raster/qgsrasterresamplefilter.h
  17. +2 −1 src/core/raster/qgsrastershaderfunction.h
  18. +2 −1 src/core/raster/qgssinglebandcolordatarenderer.h
  19. +1 −1 src/core/raster/qgssinglebandgrayrenderer.h
  20. +2 −2 src/core/raster/qgssinglebandpseudocolorrenderer.h
  21. +2 −2 src/core/symbology-ng/qgscptcityarchive.h
  22. +1 −1 src/core/symbology-ng/qgsellipsesymbollayer.h
  23. +7 −7 src/core/symbology-ng/qgsfillsymbollayer.h
  24. +1 −1 src/core/symbology-ng/qgslinesymbollayer.h
  25. +4 −4 src/core/symbology-ng/qgsmarkersymbollayer.h
  26. +1 −1 src/core/symbology-ng/qgsrenderer.h
  27. +3 −3 src/core/symbology-ng/qgsrendererregistry.h
  28. +1 −1 src/core/symbology-ng/qgssymbollayer.h
  29. +1 −1 src/core/symbology-ng/qgssymbollayerregistry.h
  30. +1 −1 src/core/symbology-ng/qgsvectorfieldsymbollayer.h
  31. +2 −1 src/gui/attributetable/qgsattributetabledelegate.h
  32. +2 −1 src/gui/attributetable/qgsifeatureselectionmanager.h
  33. +7 −6 src/gui/effects/qgspainteffectwidget.h
  34. +2 −1 src/gui/qgscomposerinterface.h
  35. +1 −1 src/gui/qgsrasterpyramidsoptionswidget.h
  36. +2 −1 src/gui/raster/qgshillshaderendererwidget.h
  37. +2 −1 src/gui/raster/qgspalettedrendererwidget.h
  38. +2 −1 src/gui/raster/qgssinglebandgrayrendererwidget.h
  39. +2 −1 src/gui/raster/qgssinglebandpseudocolorrendererwidget.h
  40. +1 −1 src/gui/symbology-ng/qgsarrowsymbollayerwidget.h
  41. +1 −1 src/gui/symbology-ng/qgsellipsesymbollayerwidget.h
  42. +16 −16 src/gui/symbology-ng/qgssymbollayerwidget.h
  43. +1 −1 src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h
@@ -40,7 +40,8 @@ while read -r sipfile; do


header=$(${GP}sed -E 's/(.*)\.sip/src\/\1.h/' <<< $sipfile)
echo "$header"
echo "*************"
echo "*** $header"

# continue

@@ -61,31 +62,32 @@ while read -r sipfile; do
#echo ${annot_head[$i]}
while read -r line; do
echo $line
line=$(${GP}sed -r 's/^\s+//; s/\s+/ /g; s/\s+$//g;' <<< $line)
line=$(${GP}sed -r 's/^\s+//; s/\s+/ /g; s/\s+$//g; s/^virtual//;' <<< $line)
orig_line=$(${GP}sed -r "s@ /${annot_head[$i]}/@@g" <<< $line)
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_dest_line=$(${GP}sed -r 's/;//g' <<< $esc_dest_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)
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)
esc_orig_line=$(${GP}sed -r 's/((= 0)?);/\( \*override\)\? \*\?\1\( \*\\{.\*\\}\|;\|$\)/g' <<< $esc_orig_line)
esc_dest_line=$(${GP}sed -r 's/( SIP_\w+)?( = 0)?(;)?$/\\1\1\2\3\\2/' <<< $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"
echo "${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
# if [[ $sipfile =~ core/qgsdiagramrenderer.sip ]]; then
# exit
# fi


if ! cmp $header $m >/dev/null 2>&1; then
if ! egrep -xq "#include \"qgis(_sip)?.h\"" $header; then
gawk -i inplace '{print} /^#include/ && !n {print "#include \"qgis.h\""; n++}' $header
gawk -i inplace '{print} /^#include/ && !n {print "#include \"qgis_sip.h\""; n++}' $header
fi
fi
rm $m
@@ -69,7 +69,7 @@ class CORE_EXPORT QgsPaintEffectAbstractMetadata
* if there's no GUI for the paint effect class.
* \returns configuration widget
*/
virtual QgsPaintEffectWidget *createWidget() { return nullptr; }
virtual QgsPaintEffectWidget *createWidget() SIP_FACTORY { return nullptr; }

protected:
QString mName;
@@ -139,7 +139,7 @@ class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata
* \note not available in Python bindings
* \see createWidget
*/
virtual QgsPaintEffectWidget *createWidget() override { return mWidgetFunc ? mWidgetFunc() : nullptr; } SIP_SKIP
virtual QgsPaintEffectWidget *createWidget() override SIP_FACTORY { return mWidgetFunc ? mWidgetFunc() : nullptr; } SIP_SKIP

protected:
QgsPaintEffectCreateFunc mCreateFunc;
@@ -562,7 +562,7 @@ class CORE_EXPORT QgsDiagramRenderer
* \see sizeLegendSymbol()
* \see setSizeLegend()
*/
void setSizeLegendSymbol( QgsMarkerSymbol *symbol ) { mSizeLegendSymbol.reset( symbol ); }
void setSizeLegendSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER ) { mSizeLegendSymbol.reset( symbol ); }

protected:
QgsDiagramRenderer( const QgsDiagramRenderer &other );
@@ -619,7 +619,7 @@ class CORE_EXPORT QgsSingleCategoryDiagramRenderer : public QgsDiagramRenderer
public:
QgsSingleCategoryDiagramRenderer();

QgsSingleCategoryDiagramRenderer *clone() const override;
QgsSingleCategoryDiagramRenderer *clone() const override SIP_FACTORY;

QString rendererName() const override { return QStringLiteral( "SingleCategory" ); }

@@ -651,7 +651,7 @@ class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer : public QgsDiagramRend
public:
QgsLinearlyInterpolatedDiagramRenderer();

QgsLinearlyInterpolatedDiagramRenderer *clone() const override;
QgsLinearlyInterpolatedDiagramRenderer *clone() const override SIP_FACTORY;

//! Returns list with all diagram settings in the renderer
QList<QgsDiagramSettings> diagramSettings() const override;
@@ -19,6 +19,7 @@
#define QGSBILINEARRASTERRESAMPLER_H

#include "qgsrasterresampler.h"
#include "qgis_sip.h"
#include <QColor>

#include "qgis_core.h"
@@ -33,7 +34,7 @@ class CORE_EXPORT QgsBilinearRasterResampler: public QgsRasterResampler

void resample( const QImage &srcImage, QImage &dstImage ) override;
QString type() const override { return QStringLiteral( "bilinear" ); }
QgsBilinearRasterResampler *clone() const override;
QgsBilinearRasterResampler *clone() const override SIP_FACTORY;
};

#endif // QGSBILINEARRASTERRESAMPLER_H
@@ -32,7 +32,7 @@ class CORE_EXPORT QgsBrightnessContrastFilter : public QgsRasterInterface
public:
QgsBrightnessContrastFilter( QgsRasterInterface *input = nullptr );

QgsBrightnessContrastFilter *clone() const override;
QgsBrightnessContrastFilter *clone() const override SIP_FACTORY;

int bandCount() const override;

@@ -19,6 +19,7 @@
#define QGSCUBICRASTERRESAMPLER_H

#include "qgsrasterresampler.h"
#include "qgis_sip.h"
#include <QColor>

#include "qgis_core.h"
@@ -30,7 +31,7 @@ class CORE_EXPORT QgsCubicRasterResampler: public QgsRasterResampler
{
public:
QgsCubicRasterResampler();
QgsCubicRasterResampler *clone() const override;
QgsCubicRasterResampler *clone() const override SIP_FACTORY;
void resample( const QImage &srcImage, QImage &dstImage ) override;
QString type() const override { return QStringLiteral( "cubic" ); }

@@ -46,7 +46,7 @@ class CORE_EXPORT QgsHillshadeRenderer : public QgsRasterRenderer
*/
QgsHillshadeRenderer( QgsRasterInterface *input, int band, double lightAzimuth, double lightAltitude );

QgsHillshadeRenderer *clone() const override;
QgsHillshadeRenderer *clone() const override SIP_FACTORY;

/**
* \brief Factory method to create a new renderer
@@ -42,7 +42,7 @@ class CORE_EXPORT QgsHueSaturationFilter : public QgsRasterInterface

QgsHueSaturationFilter( QgsRasterInterface *input = nullptr );

QgsHueSaturationFilter *clone() const override;
QgsHueSaturationFilter *clone() const override SIP_FACTORY;

int bandCount() const override;

@@ -41,7 +41,7 @@ class CORE_EXPORT QgsMultiBandColorRenderer: public QgsRasterRenderer
//! QgsMultiBandColorRenderer cannot be copied. Use clone() instead.
const QgsMultiBandColorRenderer &operator=( const QgsMultiBandColorRenderer & ) = delete;

QgsMultiBandColorRenderer *clone() const override;
QgsMultiBandColorRenderer *clone() const override SIP_FACTORY;

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

@@ -67,7 +67,7 @@ class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
//! QgsPalettedRasterRenderer cannot be copied. Use clone() instead.
const QgsPalettedRasterRenderer &operator=( const QgsPalettedRasterRenderer & ) = delete;

QgsPalettedRasterRenderer *clone() const override;
QgsPalettedRasterRenderer *clone() const override SIP_FACTORY;
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 SIP_FACTORY;
@@ -253,7 +253,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
* \since QGIS 2.8
*
*/
virtual QgsImageFetcher *getLegendGraphicFetcher( const QgsMapSettings *mapSettings )
virtual QgsImageFetcher *getLegendGraphicFetcher( const QgsMapSettings *mapSettings ) SIP_FACTORY
{
Q_UNUSED( mapSettings );
return nullptr;
@@ -261,7 +261,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** Returns the data provider in a const-correct manner
\note available in Python bindings as constDataProvider()
*/
const QgsRasterDataProvider *dataProvider() const override;
const QgsRasterDataProvider *dataProvider() const SIP_PYNAME( constDataProvider ) override;

//! Synchronises with changes in the datasource
virtual void reload() override;
@@ -19,6 +19,7 @@
#define QGSRASTERNULLER_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgsrasterrange.h"
#include "qgsrasterinterface.h"

@@ -38,7 +39,7 @@ class CORE_EXPORT QgsRasterNuller : public QgsRasterInterface
double max;
};

QgsRasterNuller *clone() const override;
QgsRasterNuller *clone() const override SIP_FACTORY;

int bandCount() const override;

@@ -24,6 +24,7 @@
#define QGSRASTERPROJECTOR_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include <QVector>
#include <QList>

@@ -57,7 +58,7 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface

QgsRasterProjector();

QgsRasterProjector *clone() const override;
QgsRasterProjector *clone() const override SIP_FACTORY;

int bandCount() const override;

@@ -19,6 +19,7 @@
#define QGSRASTERRENDERER_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include <QPair>

#include "qgsrasterinterface.h"
@@ -73,7 +74,7 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface
int alphaBand() const { return mAlphaBand; }

//! Get symbology items if provided by renderer
virtual void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const { Q_UNUSED( symbolItems ); }
virtual void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const { Q_UNUSED( symbolItems ); }

//! Sets base class members from xml. Usually called from create() methods of subclasses
void readXml( const QDomElement &rendererElem ) override;
@@ -33,7 +33,7 @@ class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface
public:
QgsRasterResampleFilter( QgsRasterInterface *input = nullptr );

QgsRasterResampleFilter *clone() const override;
QgsRasterResampleFilter *clone() const override SIP_FACTORY;

int bandCount() const override;

@@ -26,6 +26,7 @@ email : ersts@amnh.org
*/

#include "qgis_core.h"
#include "qgis_sip.h"
#include <QColor>
#include <QPair>

@@ -53,7 +54,7 @@ class CORE_EXPORT QgsRasterShaderFunction
double minimumValue() const { return mMinimumValue; }
double maximumValue() const { return mMaximumValue; }

virtual void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const { Q_UNUSED( symbolItems ); }
virtual void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const { Q_UNUSED( symbolItems ); }

protected:
//! \brief User defineable maximum value for the shading function
@@ -19,6 +19,7 @@
#define QGSSINGLEBANDCOLORDATARENDERER_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgsrasterrenderer.h"

class QDomElement;
@@ -36,7 +37,7 @@ class CORE_EXPORT QgsSingleBandColorDataRenderer: public QgsRasterRenderer
//! QgsSingleBandColorDataRenderer cannot be copied. Use clone() instead.
const QgsSingleBandColorDataRenderer &operator=( const QgsSingleBandColorDataRenderer & ) = delete;

QgsSingleBandColorDataRenderer *clone() const override;
QgsSingleBandColorDataRenderer *clone() const override SIP_FACTORY;

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

@@ -45,7 +45,7 @@ class CORE_EXPORT QgsSingleBandGrayRenderer: public QgsRasterRenderer
//! QgsSingleBandGrayRenderer cannot be copied. Use clone() instead.
const QgsSingleBandGrayRenderer &operator=( const QgsSingleBandGrayRenderer & ) = delete;

QgsSingleBandGrayRenderer *clone() const override;
QgsSingleBandGrayRenderer *clone() const override SIP_FACTORY;

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

@@ -44,7 +44,7 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer
//! QgsSingleBandPseudoColorRenderer cannot be copied. Use clone() instead.
const QgsSingleBandPseudoColorRenderer &operator=( const QgsSingleBandPseudoColorRenderer & ) = delete;

QgsSingleBandPseudoColorRenderer *clone() const override;
QgsSingleBandPseudoColorRenderer *clone() const override SIP_FACTORY;

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

@@ -57,7 +57,7 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer
QgsRasterShader *shader() { return mShader.get(); }

//! \note available in Python as constShader
const QgsRasterShader *shader() const { return mShader.get(); }
const QgsRasterShader *shader() const SIP_PYNAME( constShader ) { return mShader.get(); }

/** Creates a color ramp shader
* \param colorRamp vector color ramp
@@ -141,7 +141,7 @@ class CORE_EXPORT QgsCptCityDataItem : public QObject

virtual bool equal( const QgsCptCityDataItem *other );

virtual QWidget *paramWidget() { return nullptr; }
virtual QWidget *paramWidget() SIP_FACTORY { return nullptr; }

// list of actions provided by this item - usually used for popup menu on right-click
virtual QList<QAction *> actions() { return QList<QAction *>(); }
@@ -245,7 +245,7 @@ class CORE_EXPORT QgsCptCityCollectionItem : public QgsCptCityDataItem
~QgsCptCityCollectionItem();

void setPopulated() { mPopulated = true; }
void addChild( QgsCptCityDataItem *item ) { mChildren.append( item ); }
void addChild( QgsCptCityDataItem *item SIP_TRANSFER ) { mChildren.append( item ); }
QVector<QgsCptCityDataItem *> childrenRamps( bool recursive );

protected:
@@ -38,7 +38,7 @@ class CORE_EXPORT QgsEllipseSymbolLayer: public QgsMarkerSymbolLayer
QString layerType() const override;
void startRender( QgsSymbolRenderContext &context ) override;
void stopRender( QgsSymbolRenderContext &context ) override;
QgsEllipseSymbolLayer *clone() const override;
QgsEllipseSymbolLayer *clone() const override SIP_FACTORY;
QgsStringMap properties() const override;

void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;

0 comments on commit 2929f9d

Please sign in to comment.