Skip to content
Permalink
Browse files

Add SIP_FINAL

  • Loading branch information
m-kuhn committed Sep 18, 2018
1 parent ddaa8ea commit d9f5d5377994f775f24e8c12d3c5a65d561d1876
Showing with 50 additions and 40 deletions.
  1. +1 −1 scripts/sipify.pl
  2. +10 −0 src/core/qgis_sip.h
  3. +39 −39 src/core/qgsvectorlayer.h
@@ -965,7 +965,7 @@ sub detect_non_method_member{
do {no warnings 'uninitialized';
$LINE =~ s/^(\s*template\s*<)(?:class|typename) (\w+>)(.*)$/$1$2$3/;
$LINE =~ s/\s*\boverride\b//;
$LINE =~ s/\s*\bfinal\b/ final/;
$LINE =~ s/\s*\bSIP_FINAL\b/ final/;
$LINE =~ s/\s*\bextern \b//;
$LINE =~ s/\s*\bMAYBE_UNUSED \b//;
$LINE =~ s/\s*\bNODISCARD \b//;
@@ -197,6 +197,16 @@
*/
#define SIP_DOC_TEMPLATE

/*
* Sip supports the final keyword since version 4.19.0, earlier than that
* 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
#endif

/*
* Define Python special method (bool, repr, etc.) using the given method or code
* sipify.pl will create a dedicated python file named according to the class
@@ -484,8 +484,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
*/
QString displayExpression() const;

QgsVectorDataProvider *dataProvider() final;
const QgsVectorDataProvider *dataProvider() const final SIP_SKIP;
QgsVectorDataProvider *dataProvider() SIP_FINAL;
const QgsVectorDataProvider *dataProvider() const SIP_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<QgsMapLayerDependency> &layers ) final;
bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) SIP_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<QgsMapLayerDependency> dependencies() const final;
QSet<QgsMapLayerDependency> dependencies() const SIP_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 final;
QgsWkbTypes::Type wkbType() const SIP_FINAL;

//! Returns the provider type for this layer
QString providerType() const;

QgsCoordinateReferenceSystem sourceCrs() const final;
QString sourceName() const final;
QgsCoordinateReferenceSystem sourceCrs() const SIP_FINAL;
QString sourceName() const SIP_FINAL;

/**
* Reads vector layer specific state from project file Dom node.
* \note Called by QgsMapLayer::readXml().
*/
bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) final;
bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) SIP_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 final;
bool writeXml( QDomNode &layer_node, QDomDocument &doc, 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;
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;

/**
* Resolve references to other layers (kept as layer IDs after reading XML) into layer objects.
* \since QGIS 3.0
*/
void resolveReferences( QgsProject *project ) final;
void resolveReferences( QgsProject *project ) SIP_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 ) final;
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) SIP_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 ) final;
QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) SIP_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 ) final;
QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) SIP_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 final;
const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const SIP_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 final;
const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const SIP_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 ) final;
bool readSld( const QDomNode &node, QString &errorMessage ) SIP_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 final;
FeatureAvailability hasFeatures() const SIP_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 ) final;
QString loadDefaultStyle( bool &resultFlag SIP_OUT ) SIP_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 final;
QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const SIP_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 ) final;
bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) SIP_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 final;
bool isEditable() const SIP_FINAL;

//! Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry
bool isSpatial() const final;
bool isSpatial() const SIP_FINAL;

//! Returns true if the provider has been modified since the last commit
virtual bool isModified() const;
@@ -1352,24 +1352,24 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
bool isAuxiliaryField( int index, int &srcIndex ) const;

//! Synchronises with changes in the datasource
void reload() final;
void reload() SIP_FINAL;

/**
* Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context
* \since QGIS 2.4
*/
QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) final SIP_FACTORY;
QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) SIP_FINAL SIP_FACTORY;

QgsRectangle extent() const final;
QgsRectangle sourceExtent() const final;
QgsRectangle extent() const SIP_FINAL;
QgsRectangle sourceExtent() const SIP_FINAL;

/**
* Returns the list of fields of this layer.
* This also includes fields which have not yet been saved to the provider.
*
* \returns A list of fields
*/
QgsFields fields() const final;
QgsFields fields() const SIP_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 final;
long featureCount() const SIP_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<int> &attrs );

bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) final;
bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) SIP_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<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const final;
QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const SIP_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 final;
QVariant minimumValue( int index ) const SIP_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 final;
QVariant maximumValue( int index ) const SIP_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 final;
QString htmlMetadata() const SIP_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 final;
QgsExpressionContext createExpressionContext() const SIP_FINAL;

QgsExpressionContextScope *createExpressionContextScope() const final SIP_FACTORY;
QgsExpressionContextScope *createExpressionContextScope() const SIP_FINAL SIP_FACTORY;

/**
* Returns the configuration of the form used to represent this vector layer.
@@ -2338,15 +2338,15 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte

protected:
//! Sets the extent
void setExtent( const QgsRectangle &rect ) final;
void setExtent( const QgsRectangle &rect ) SIP_FINAL;

private:
void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature() );

/**
* Returns true if the provider is in read-only mode
*/
bool isReadOnly() const final;
bool isReadOnly() const SIP_FINAL;

/**
* Bind layer to a specific data provider

0 comments on commit d9f5d53

Please sign in to comment.
You can’t perform that action at this time.