Add c++20 todo for replacing equality operators with default implementations

This commit is contained in:
Nyall Dawson 2021-07-02 08:39:20 +10:00
parent 65bccd2c61
commit c8156b0106
49 changed files with 63 additions and 3 deletions

View File

@ -132,6 +132,7 @@ Create a new Change
QgsGeometryCheck::ChangeType type;
QgsVertexId vidx;
bool operator==( const QgsGeometryCheck::Change &other );
};

View File

@ -31,6 +31,7 @@ Construct a configuration for an authentication method
:param version: Version of the configuration (for updating previously saved configs later on)
%End
bool operator==( const QgsAuthMethodConfig &other ) const;
bool operator!=( const QgsAuthMethodConfig &other ) const;

View File

@ -85,7 +85,6 @@ Copy constructor
%End
~QgsEditFormConfig();
bool operator==( const QgsEditFormConfig &o );
void addTab( QgsAttributeEditorElement *data /Transfer/ );

View File

@ -191,6 +191,7 @@ on the line, or exactly in line with the segment) and the result is undefined.
Reverses the line segment, so that the start and end points are flipped.
%End
bool operator==( const QgsLineSegment2D &other ) const /HoldGIL/;
bool operator!=( const QgsLineSegment2D &other ) const /HoldGIL/;

View File

@ -44,6 +44,7 @@ Create a new default value with the given ``expression`` and ``applyOnUpdate`` f
.. seealso:: :py:func:`QgsVectorLayer.setDefaultValueDefinition`
%End
bool operator==( const QgsDefaultValue &other ) const;
QString expression() const;

View File

@ -60,6 +60,7 @@ Returns the dependency origin
Returns the ID of the layer this dependency depends on
%End
bool operator==( const QgsMapLayerDependency &other ) const;
//! hash operator

View File

@ -45,6 +45,7 @@ Returns the message level
Returns the stack of categories of the message
%End
bool operator==( const QgsReadWriteContext::ReadWriteMessage &other ) const;
bool operator!=( const QgsReadWriteContext::ReadWriteMessage &other ) const;

View File

@ -69,6 +69,7 @@ Returns the key associated to the symbol
Returns the symbol layer index path inside the symbol
%End
bool operator==( const QgsSymbolLayerId &other ) const;
bool operator<( const QgsSymbolLayerId &other ) const;

View File

@ -68,6 +68,7 @@ struct QgsChunkNodeId
return QStringLiteral( "%1/%2/%3/%4" ).arg( d ).arg( x ).arg( y ).arg( z ); // octree
}
// TODO c++20 - replace with = default
bool operator==( const QgsChunkNodeId &other ) const
{
return d == other.d && x == other.x && y == other.y && z == other.z;

View File

@ -108,6 +108,7 @@ class _3D_EXPORT QgsGoochMaterialSettings : public QgsAbstractMaterialSettings
#endif
// TODO c++20 - replace with = default
bool operator==( const QgsGoochMaterialSettings &other ) const
{
return mDiffuse == other.mDiffuse &&

View File

@ -96,6 +96,7 @@ class _3D_EXPORT QgsPhongMaterialSettings : public QgsAbstractMaterialSettings
void applyDataDefinedToGeometry( Qt3DRender::QGeometry *geometry, int vertexCount, const QByteArray &data ) const override;
#endif
// TODO c++20 - replace with = default
bool operator==( const QgsPhongMaterialSettings &other ) const
{
return mAmbient == other.mAmbient &&

View File

@ -120,6 +120,7 @@ class _3D_EXPORT QgsPhongTexturedMaterialSettings : public QgsAbstractMaterialSe
void addParametersToEffect( Qt3DRender::QEffect *effect ) const override;
#endif
// TODO c++20 - replace with = default
bool operator==( const QgsPhongTexturedMaterialSettings &other ) const
{
return mAmbient == other.mAmbient &&

View File

@ -78,6 +78,7 @@ class _3D_EXPORT QgsSimpleLineMaterialSettings : public QgsAbstractMaterialSetti
void addParametersToEffect( Qt3DRender::QEffect *effect ) const override;
#endif
// TODO c++20 - replace with = default
bool operator==( const QgsSimpleLineMaterialSettings &other ) const
{
return mAmbient == other.mAmbient;

View File

@ -75,6 +75,7 @@ class _3D_EXPORT QgsCameraPose
//! Reads configuration from a DOM element previously written using writeXml()
void readXml( const QDomElement &elem );
// TODO c++20 - replace with = default
bool operator==( const QgsCameraPose &other ) const
{
return mCenterPoint == other.mCenterPoint &&

View File

@ -55,6 +55,7 @@ class _3D_EXPORT QgsDirectionalLightSettings
//! Reads configuration from a DOM element previously written using writeXml()
void readXml( const QDomElement &elem );
// TODO c++20 - replace with = default
bool operator==( const QgsDirectionalLightSettings &other );
private:

View File

@ -76,6 +76,7 @@ class _3D_EXPORT QgsPointLightSettings
//! Reads configuration from a DOM element previously written using writeXml()
void readXml( const QDomElement &elem );
// TODO c++20 - replace with = default
bool operator==( const QgsPointLightSettings &other );
private:

View File

@ -75,6 +75,7 @@ namespace QgsRayCastingUtils
Ray3D &transform( const QMatrix4x4 &matrix );
Ray3D transformed( const QMatrix4x4 &matrix ) const;
// TODO c++20 - replace with = default
bool operator==( const Ray3D &other ) const;
bool operator!=( const Ray3D &other ) const;

View File

@ -48,6 +48,7 @@ class ANALYSIS_EXPORT Vector3D
//! Default constructor
Vector3D() = default;
// TODO c++20 - replace with = default
bool operator==( const Vector3D &v ) const;
bool operator!=( const Vector3D &v ) const;
//! Returns the x-component of the vector

View File

@ -200,6 +200,8 @@ class ANALYSIS_EXPORT QgsGeometryCheck
* The index of the part / ring / vertex, depending on \see what.
*/
QgsVertexId vidx;
// TODO c++20 - replace with = default
bool operator==( const QgsGeometryCheck::Change &other )
{
return what == other.what && type == other.type && vidx == other.vidx;

View File

@ -42,6 +42,7 @@ struct Vertex
, fid( fid )
, vertexId( vertexId ) {}
// TODO c++20 - replace with = default
bool operator==( const Vertex &other ) const
{
return layer == other.layer && fid == other.fid && vertexId == other.vertexId;

View File

@ -49,6 +49,8 @@ class CORE_EXPORT QgsAuthMethodConfig
*/
QgsAuthMethodConfig( const QString &method = QString(), int version = 0 );
// TODO c++20 - replace with = default
//! Operator used to compare configs' equality
bool operator==( const QgsAuthMethodConfig &other ) const;

View File

@ -124,7 +124,7 @@ class CORE_EXPORT QgsEditFormConfig
~QgsEditFormConfig();
QgsEditFormConfig &operator=( const QgsEditFormConfig &o );
// TODO c++20 - replace with = default
bool operator==( const QgsEditFormConfig &o );
/**

View File

@ -2312,6 +2312,7 @@ class CORE_EXPORT QgsGeometry
% End
#endif
// TODO c++20 - replace with = default
bool operator==( const QgsGeometry::Error &other ) const
{
return other.mMessage == mMessage && other.mHasLocation == mHasLocation && other.mLocation == mLocation;

View File

@ -218,6 +218,8 @@ class CORE_EXPORT QgsLineSegment2D
std::swap( mStart, mEnd );
}
// TODO c++20 - replace with = default
//! Equality operator
bool operator==( const QgsLineSegment2D &other ) const SIP_HOLDGIL
{

View File

@ -127,6 +127,7 @@ class CORE_EXPORT QgsAbstractMetadataBase
*/
QString country;
// TODO c++20 - replace with = default
bool operator==( const QgsAbstractMetadataBase::Address &other ) const;
};
@ -188,6 +189,7 @@ class CORE_EXPORT QgsAbstractMetadataBase
*/
QString role;
// TODO c++20 - replace with = default
bool operator==( const QgsAbstractMetadataBase::Contact &other ) const;
};
@ -252,6 +254,7 @@ class CORE_EXPORT QgsAbstractMetadataBase
*/
QString size;
// TODO c++20 - replace with = default
bool operator==( const QgsAbstractMetadataBase::Link &other ) const;
};

View File

@ -81,6 +81,7 @@ class CORE_EXPORT QgsLayerMetadata : public QgsAbstractMetadataBase
*/
QgsBox3d bounds;
// TODO c++20 - replace with = default
bool operator==( const QgsLayerMetadata::SpatialExtent &other ) const;
};
@ -118,6 +119,7 @@ class CORE_EXPORT QgsLayerMetadata : public QgsAbstractMetadataBase
*/
void setTemporalExtents( const QList< QgsDateTimeRange > &extents );
// TODO c++20 - replace with = default
bool operator==( const QgsLayerMetadata::Extent &other ) const;
#ifndef SIP_RUN
@ -155,6 +157,7 @@ class CORE_EXPORT QgsLayerMetadata : public QgsAbstractMetadataBase
*/
QString constraint;
// TODO c++20 - replace with = default
bool operator==( const QgsLayerMetadata::Constraint &other ) const;
};

View File

@ -62,6 +62,8 @@ class CORE_EXPORT IndexedPointCloudNode
//! Returns whether node is valid
bool isValid() const { return mD >= 0; }
// TODO c++20 - replace with = default
//! Compares nodes
bool operator==( IndexedPointCloudNode other ) const
{

View File

@ -72,6 +72,7 @@ class CORE_EXPORT QgsProcessingModelChildDependency
return true;
}
// TODO c++20 - replace with = default
bool operator==( const QgsProcessingModelChildDependency &other ) const
{
return childId == other.childId && conditionalBranch == other.conditionalBranch;

View File

@ -162,6 +162,7 @@ class CORE_EXPORT QgsProcessingFeatureSourceDefinition
*/
bool loadVariant( const QVariantMap &map );
// TODO c++20 - replace with = default
bool operator==( const QgsProcessingFeatureSourceDefinition &other ) const
{
return source == other.source
@ -296,6 +297,7 @@ class CORE_EXPORT QgsProcessingOutputLayerDefinition
return QVariant::fromValue( *this );
}
// TODO c++20 - replace with = default
bool operator==( const QgsProcessingOutputLayerDefinition &other ) const;
bool operator!=( const QgsProcessingOutputLayerDefinition &other ) const;

View File

@ -64,6 +64,7 @@ class QgsCoordinateTransformContextPrivate : public QSharedData
QString operation;
bool allowFallback = true;
// TODO c++20 - replace with = default
bool operator==( const OperationDetails &other ) const
{
return operation == other.operation && allowFallback == other.allowFallback;

View File

@ -73,6 +73,7 @@ class CORE_EXPORT QgsDatumTransform
*/
int destinationTransformId = -1;
// TODO c++20 - replace with = default
bool operator==( QgsDatumTransform::TransformPair other ) const
{
return other.sourceTransformId == sourceTransformId && other.destinationTransformId == destinationTransformId;

View File

@ -234,6 +234,7 @@ class CORE_EXPORT QgsAbstractDatabaseProviderConnection : public QgsAbstractProv
QgsWkbTypes::Type wkbType;
QgsCoordinateReferenceSystem crs;
// TODO c++20 - replace with = default
inline bool operator==( const GeometryColumnType &other ) const
{
return this->crs == other.crs && this->wkbType == other.wkbType;

View File

@ -230,6 +230,7 @@ class CORE_EXPORT QgsProviderSublayerDetails
*/
void setLayerNumber( int number ) { mLayerNumber = number; }
// TODO c++20 - replace with = default
bool operator==( const QgsProviderSublayerDetails &other ) const;
bool operator!=( const QgsProviderSublayerDetails &other ) const;

View File

@ -54,6 +54,7 @@ class CORE_EXPORT QgsAttributeTableConfig
//! Constructor for ColumnConfig
ColumnConfig() = default;
// TODO c++20 - replace with = default
bool operator== ( const QgsAttributeTableConfig::ColumnConfig &other ) const SIP_SKIP;
QgsAttributeTableConfig::Type type = Field; //!< The type of this column.

View File

@ -116,6 +116,7 @@ class CORE_EXPORT QgsBookmark
% End
#endif
// TODO c++20 - replace with = default
bool operator==( const QgsBookmark &other );
bool operator!=( const QgsBookmark &other );

View File

@ -59,6 +59,8 @@ class CORE_EXPORT QgsDefaultValue
* \see QgsVectorLayer::setDefaultValueDefinition
*/
explicit QgsDefaultValue( const QString &expression = QString(), bool applyOnUpdate = false );
// TODO c++20 - replace with = default
bool operator==( const QgsDefaultValue &other ) const;
/**

View File

@ -84,6 +84,7 @@ class QgsFieldPrivate : public QSharedData
~QgsFieldPrivate() = default;
// TODO c++20 - replace with = default
bool operator==( const QgsFieldPrivate &other ) const
{
return ( ( name == other.name ) && ( type == other.type ) && ( subType == other.subType )

View File

@ -141,6 +141,7 @@ class CORE_EXPORT QgsFieldConstraints
*/
void setConstraintExpression( const QString &expression, const QString &description = QString() );
// TODO c++20 - replace with = default
bool operator==( const QgsFieldConstraints &other ) const;
private:

View File

@ -67,6 +67,8 @@ class CORE_EXPORT QgsFields
, originIndex( oi )
{}
// TODO c++20 - replace with = default
//! \since QGIS 2.6
bool operator==( const Field &other ) const { return field == other.field && origin == other.origin && originIndex == other.originIndex; }
//! \since QGIS 2.6

View File

@ -67,6 +67,8 @@ class CORE_EXPORT QgsMapLayerDependency
//! Returns the ID of the layer this dependency depends on
QString layerId() const { return mLayerId; }
// TODO c++20 - replace with = default
//! Comparison operator
bool operator==( const QgsMapLayerDependency &other ) const
{

View File

@ -61,6 +61,7 @@ class CORE_EXPORT QgsMapThemeCollection : public QObject
//! Initialize layer record with a map layer - it will be stored as a weak pointer
MapThemeLayerRecord( QgsMapLayer *l = nullptr ): mLayer( l ) {}
// TODO c++20 - replace with = default
bool operator==( const QgsMapThemeCollection::MapThemeLayerRecord &other ) const
{
return mLayer == other.mLayer && isVisible == other.isVisible &&

View File

@ -276,6 +276,7 @@ class CORE_EXPORT QgsPointLocator : public QObject
return point;
}
// TODO c++20 - replace with = default
bool operator==( const QgsPointLocator::Match &other ) const
{
return mType == other.mType &&

View File

@ -57,6 +57,8 @@ class CORE_EXPORT QgsReadWriteContext
//! Returns the stack of categories of the message
QStringList categories() const {return mCategories;}
// TODO c++20 - replace with = default
bool operator==( const QgsReadWriteContext::ReadWriteMessage &other ) const
{
return mMessage == other.mMessage && mLevel == other.mLevel && mCategories == other.mCategories;

View File

@ -143,6 +143,7 @@ class CORE_EXPORT QgsRemappingSinkDefinition
*/
bool loadVariant( const QVariantMap &map );
// TODO c++20 - replace with = default
bool operator==( const QgsRemappingSinkDefinition &other ) const;
bool operator!=( const QgsRemappingSinkDefinition &other ) const;

View File

@ -219,6 +219,7 @@ class CORE_EXPORT QgsSnappingConfig
*/
bool operator!= ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
// TODO c++20 - replace with = default
bool operator== ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
private:

View File

@ -146,6 +146,7 @@ class CORE_EXPORT QgsSnappingUtils : public QObject
, unit( u )
{}
// TODO c++20 - replace with = default
bool operator==( const QgsSnappingUtils::LayerConfig &other ) const
{
return layer == other.layer && type == other.type && tolerance == other.tolerance && unit == other.unit;

View File

@ -65,9 +65,10 @@ class CORE_EXPORT QgsTimeDuration
!hours && !minutes && !seconds;
}
// TODO c++20 - replace with = default
bool operator==( const QgsTimeDuration &other ) const
{
return years == other.years && months == other.months &&
return years == other.years && months == other.months && weeks == other.weeks &&
days == other.days && hours == other.hours &&
minutes == other.minutes && seconds == other.seconds;
}

View File

@ -60,6 +60,7 @@ class CORE_EXPORT QgsVector3D
mZ = z;
}
// TODO c++20 - replace with = default
bool operator==( const QgsVector3D &other ) const
{
return mX == other.mX && mY == other.mY && mZ == other.mZ;

View File

@ -85,6 +85,8 @@ class CORE_EXPORT QgsSymbolLayerId
*/
QVector<int> symbolLayerIndexPath() const { return mIndexPath; }
// TODO c++20 - replace with = default
//! Equality operator
bool operator==( const QgsSymbolLayerId &other ) const
{