From b65f725cfa246b656fca0f3fb4cc52a04c441db0 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 19 Sep 2018 08:42:44 +0200 Subject: [PATCH] Rename SIP_FINAL to FINAL --- python/core/auto_generated/qgis.sip.in | 1 - scripts/sipify.pl | 2 +- src/core/qgis.h | 4 +- src/core/qgis_sip.h | 7 ++- src/core/qgsvectorlayer.h | 78 +++++++++++++------------- 5 files changed, 47 insertions(+), 45 deletions(-) diff --git a/python/core/auto_generated/qgis.sip.in b/python/core/auto_generated/qgis.sip.in index 69c0de773d0..6d300d24b34 100644 --- a/python/core/auto_generated/qgis.sip.in +++ b/python/core/auto_generated/qgis.sip.in @@ -232,7 +232,6 @@ typedef unsigned long long qgssize; - /************************************************************************ * This file has been generated automatically from * * * diff --git a/scripts/sipify.pl b/scripts/sipify.pl index c110b993e36..30a86a19561 100755 --- a/scripts/sipify.pl +++ b/scripts/sipify.pl @@ -965,7 +965,7 @@ while ($LINE_IDX < $LINE_COUNT){ do {no warnings 'uninitialized'; $LINE =~ s/^(\s*template\s*<)(?:class|typename) (\w+>)(.*)$/$1$2$3/; $LINE =~ s/\s*\boverride\b//; - $LINE =~ s/\s*\bSIP_FINAL\b/ \${SIP_FINAL}/; + $LINE =~ s/\s*\bFINAL\b/ \${SIP_FINAL}/; $LINE =~ s/\s*\bextern \b//; $LINE =~ s/\s*\bMAYBE_UNUSED \b//; $LINE =~ s/\s*\bNODISCARD \b//; diff --git a/src/core/qgis.h b/src/core/qgis.h index 7aad690ded5..206a02eefe5 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -636,6 +636,8 @@ typedef unsigned long long qgssize; #define MAYBE_UNUSED #endif - +#ifndef FINAL +#define FINAL final +#endif diff --git a/src/core/qgis_sip.h b/src/core/qgis_sip.h index bcdad76e74a..2772a9da44b 100644 --- a/src/core/qgis_sip.h +++ b/src/core/qgis_sip.h @@ -202,9 +202,10 @@ * we will have build issues because it tries to override final methods. */ #if SIP_VERSION >= 0x041300 -#define SIP_FINAL final -#else -#define SIP_FINAL override +#if defined FINAL +#undef FINAL +#endif +#define FINAL override #endif /* diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h index e47bcfd3d72..d267b8c3f73 100644 --- a/src/core/qgsvectorlayer.h +++ b/src/core/qgsvectorlayer.h @@ -484,8 +484,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte */ QString displayExpression() const; - QgsVectorDataProvider *dataProvider() SIP_FINAL; - const QgsVectorDataProvider *dataProvider() const SIP_FINAL SIP_SKIP; + QgsVectorDataProvider *dataProvider() FINAL; + const QgsVectorDataProvider *dataProvider() const FINAL SIP_SKIP; //! Sets the textencoding of the data provider void setProviderEncoding( const QString &encoding ); @@ -519,7 +519,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \returns false if a dependency cycle has been detected * \since QGIS 3.0 */ - bool setDependencies( const QSet &layers ) SIP_FINAL; + bool setDependencies( const QSet &layers ) FINAL; /** * Gets the list of dependencies. This includes data dependencies set by the user (\see setDataDependencies) @@ -528,7 +528,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \returns a set of QgsMapLayerDependency * \since QGIS 3.0 */ - QSet dependencies() const SIP_FINAL; + QSet dependencies() const FINAL; /** * Add a new field which is calculated by the expression specified @@ -752,34 +752,34 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte QgsWkbTypes::GeometryType geometryType() const; //! Returns the WKBType or WKBUnknown in case of error - QgsWkbTypes::Type wkbType() const SIP_FINAL; + QgsWkbTypes::Type wkbType() const FINAL; //! Returns the provider type for this layer QString providerType() const; - QgsCoordinateReferenceSystem sourceCrs() const SIP_FINAL; - QString sourceName() const SIP_FINAL; + QgsCoordinateReferenceSystem sourceCrs() const FINAL; + QString sourceName() const FINAL; /** * Reads vector layer specific state from project file Dom node. * \note Called by QgsMapLayer::readXml(). */ - bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) SIP_FINAL; + bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) FINAL; /** * Write vector layer specific state to project file Dom node. * \note Called by QgsMapLayer::writeXml(). */ - bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const SIP_FINAL; + bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const FINAL; - QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const SIP_FINAL; - QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const SIP_FINAL; + QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const FINAL; + QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const FINAL; /** * Resolve references to other layers (kept as layer IDs after reading XML) into layer objects. * \since QGIS 3.0 */ - void resolveReferences( QgsProject *project ) SIP_FINAL; + void resolveReferences( QgsProject *project ) FINAL; /** * Save named and sld style of the layer to the style table in the db. @@ -834,7 +834,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * Retained for backward compatibility */ QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, - QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) SIP_FINAL; + QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) FINAL; /** * Loads the auxiliary layer for this vector layer. If there's no @@ -885,7 +885,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \returns true in case of success. */ bool readSymbology( const QDomNode &layerNode, QString &errorMessage, - QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) SIP_FINAL; + QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) FINAL; /** * Read the style for the current layer from the Dom node supplied. @@ -896,7 +896,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \returns true in case of success. */ bool readStyle( const QDomNode &node, QString &errorMessage, - QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) SIP_FINAL; + QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) FINAL; /** * Write the symbology for the layer into the docment provided. @@ -908,7 +908,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \returns true in case of success. */ bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, - const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const SIP_FINAL; + const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const FINAL; /** * Write just the style information for the layer into the document @@ -920,7 +920,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \returns true in case of success. */ bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, - const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const SIP_FINAL; + const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const FINAL; /** * Writes the symbology of the layer into the document provided in SLD 1.1 format @@ -932,7 +932,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte */ bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const; - bool readSld( const QDomNode &node, QString &errorMessage ) SIP_FINAL; + bool readSld( const QDomNode &node, QString &errorMessage ) FINAL; /** * Number of features rendered with specified legend key. Features must be first @@ -951,7 +951,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * * \since QGIS 3.4 */ - FeatureAvailability hasFeatures() const SIP_FINAL; + FeatureAvailability hasFeatures() const FINAL; /** * Update the data source of the layer. The layer's renderer and legend will be preserved only @@ -980,7 +980,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte */ void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag = false ); - QString loadDefaultStyle( bool &resultFlag SIP_OUT ) SIP_FINAL; + QString loadDefaultStyle( bool &resultFlag SIP_OUT ) FINAL; /** * Count features for symbols. @@ -1016,7 +1016,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \param request feature request describing parameters of features to return * \returns iterator for matching features from provider */ - QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const SIP_FINAL; + QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const FINAL; /** * Query the layer for features matching a given expression. @@ -1053,7 +1053,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte return getFeatures( QgsFeatureRequest( rectangle ) ); } - bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) SIP_FINAL; + bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) FINAL; /** * Updates an existing \a feature in the layer, replacing the attributes and geometry for the feature @@ -1335,10 +1335,10 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER ); //! Returns true if the provider is in editing mode - bool isEditable() const SIP_FINAL; + bool isEditable() const FINAL; //! Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry - bool isSpatial() const SIP_FINAL; + bool isSpatial() const FINAL; //! Returns true if the provider has been modified since the last commit virtual bool isModified() const; @@ -1352,16 +1352,16 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte bool isAuxiliaryField( int index, int &srcIndex ) const; //! Synchronises with changes in the datasource - void reload() SIP_FINAL; + void reload() FINAL; /** * Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context * \since QGIS 2.4 */ - QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) SIP_FINAL SIP_FACTORY; + QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) FINAL SIP_FACTORY; - QgsRectangle extent() const SIP_FINAL; - QgsRectangle sourceExtent() const SIP_FINAL; + QgsRectangle extent() const FINAL; + QgsRectangle sourceExtent() const FINAL; /** * Returns the list of fields of this layer. @@ -1369,7 +1369,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * * \returns A list of fields */ - QgsFields fields() const SIP_FINAL; + QgsFields fields() const FINAL; /** * Returns list of attribute indexes. i.e. a list from 0 ... fieldCount() @@ -1385,7 +1385,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * Returns feature count including changes which have not yet been committed * If you need only the count of committed features call this method on this layer's provider. */ - long featureCount() const SIP_FINAL; + long featureCount() const FINAL; /** * Make layer read-only (editing disabled) or not @@ -1574,7 +1574,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte */ bool deleteAttributes( const QList &attrs ); - bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) SIP_FINAL; + bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) FINAL; /** * Deletes a feature from the layer (but does not commit it). @@ -1819,7 +1819,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \see minimumValue() * \see maximumValue() */ - QSet uniqueValues( int fieldIndex, int limit = -1 ) const SIP_FINAL; + QSet uniqueValues( int fieldIndex, int limit = -1 ) const FINAL; /** * Returns unique string values of an attribute which contain a specified subset string. Subset @@ -1845,7 +1845,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \see maximumValue() * \see uniqueValues() */ - QVariant minimumValue( int index ) const SIP_FINAL; + QVariant minimumValue( int index ) const FINAL; /** * Returns the maximum value for an attribute column or an invalid variant in case of error. @@ -1855,7 +1855,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \see minimumValue() * \see uniqueValues() */ - QVariant maximumValue( int index ) const SIP_FINAL; + QVariant maximumValue( int index ) const FINAL; /** * Calculates an aggregated value from the layer's features. @@ -1896,7 +1896,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte */ double opacity() const; - QString htmlMetadata() const SIP_FINAL; + QString htmlMetadata() const FINAL; /** * Set the simplification settings for fast rendering of features @@ -1956,9 +1956,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte */ void setMapTipTemplate( const QString &mapTipTemplate ); - QgsExpressionContext createExpressionContext() const SIP_FINAL; + QgsExpressionContext createExpressionContext() const FINAL; - QgsExpressionContextScope *createExpressionContextScope() const SIP_FINAL SIP_FACTORY; + QgsExpressionContextScope *createExpressionContextScope() const FINAL SIP_FACTORY; /** * Returns the configuration of the form used to represent this vector layer. @@ -2328,7 +2328,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte protected: //! Sets the extent - void setExtent( const QgsRectangle &rect ) SIP_FINAL; + void setExtent( const QgsRectangle &rect ) FINAL; private slots: void invalidateSymbolCountedFlag(); @@ -2346,7 +2346,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte /** * Returns true if the provider is in read-only mode */ - bool isReadOnly() const SIP_FINAL; + bool isReadOnly() const FINAL; /** * Bind layer to a specific data provider