Skip to content

Commit 8ba442f

Browse files
committed
Const correctness for QgsGeometry::Error
1 parent a6e0e39 commit 8ba442f

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

python/core/auto_generated/geometry/qgsgeometry.sip.in

+4-3
Original file line numberDiff line numberDiff line change
@@ -1481,9 +1481,10 @@ by calling `error()` on the returned geometry.
14811481
explicit Error( const QString &m );
14821482

14831483
Error( const QString &m, const QgsPointXY &p );
1484-
QString what();
1485-
QgsPointXY where();
1486-
bool hasWhere();
1484+
QString what() const;
1485+
QgsPointXY where() const;
1486+
bool hasWhere() const;
1487+
14871488
};
14881489

14891490
enum ValidationMethod

src/core/geometry/qgsgeometry.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -3288,3 +3288,18 @@ QDataStream &operator>>( QDataStream &in, QgsGeometry &geometry )
32883288
return in;
32893289
}
32903290

3291+
3292+
QString QgsGeometry::Error::what() const
3293+
{
3294+
return mMessage;
3295+
}
3296+
3297+
QgsPointXY QgsGeometry::Error::where() const
3298+
{
3299+
return mLocation;
3300+
}
3301+
3302+
bool QgsGeometry::Error::hasWhere() const
3303+
{
3304+
return mHasLocation;
3305+
}

src/core/geometry/qgsgeometry.h

+14-13
Original file line numberDiff line numberDiff line change
@@ -1418,27 +1418,28 @@ class CORE_EXPORT QgsGeometry
14181418
*/
14191419
class CORE_EXPORT Error
14201420
{
1421-
QString message;
1422-
QgsPointXY location;
1423-
bool hasLocation = false;
1424-
14251421
public:
14261422
Error()
1427-
: message( QStringLiteral( "none" ) )
1423+
: mMessage( QStringLiteral( "none" ) )
14281424
{}
14291425

14301426
explicit Error( const QString &m )
1431-
: message( m )
1427+
: mMessage( m )
14321428
{}
14331429

14341430
Error( const QString &m, const QgsPointXY &p )
1435-
: message( m )
1436-
, location( p )
1437-
, hasLocation( true ) {}
1438-
1439-
QString what() { return message; }
1440-
QgsPointXY where() { return location; }
1441-
bool hasWhere() { return hasLocation; }
1431+
: mMessage( m )
1432+
, mLocation( p )
1433+
, mHasLocation( true ) {}
1434+
1435+
QString what() const;
1436+
QgsPointXY where() const;
1437+
bool hasWhere() const;
1438+
1439+
private:
1440+
QString mMessage;
1441+
QgsPointXY mLocation;
1442+
bool mHasLocation = false;
14421443
};
14431444

14441445
/**

0 commit comments

Comments
 (0)