Skip to content
Permalink
Browse files

Const correctness for QgsGeometry::Error

  • Loading branch information
m-kuhn committed Sep 7, 2018
1 parent a6e0e39 commit 8ba442f14a23a004ac204a2308f335ea1f65bf05
@@ -1481,9 +1481,10 @@ by calling `error()` on the returned geometry.
explicit Error( const QString &m );

Error( const QString &m, const QgsPointXY &p );
QString what();
QgsPointXY where();
bool hasWhere();
QString what() const;
QgsPointXY where() const;
bool hasWhere() const;

};

enum ValidationMethod
@@ -3288,3 +3288,18 @@ QDataStream &operator>>( QDataStream &in, QgsGeometry &geometry )
return in;
}


QString QgsGeometry::Error::what() const
{
return mMessage;
}

QgsPointXY QgsGeometry::Error::where() const
{
return mLocation;
}

bool QgsGeometry::Error::hasWhere() const
{
return mHasLocation;
}
@@ -1418,27 +1418,28 @@ class CORE_EXPORT QgsGeometry
*/
class CORE_EXPORT Error
{
QString message;
QgsPointXY location;
bool hasLocation = false;

public:
Error()
: message( QStringLiteral( "none" ) )
: mMessage( QStringLiteral( "none" ) )
{}

explicit Error( const QString &m )
: message( m )
: mMessage( m )
{}

Error( const QString &m, const QgsPointXY &p )
: message( m )
, location( p )
, hasLocation( true ) {}

QString what() { return message; }
QgsPointXY where() { return location; }
bool hasWhere() { return hasLocation; }
: mMessage( m )
, mLocation( p )
, mHasLocation( true ) {}

QString what() const;
QgsPointXY where() const;
bool hasWhere() const;

private:
QString mMessage;
QgsPointXY mLocation;
bool mHasLocation = false;
};

/**

0 comments on commit 8ba442f

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