Navigation Menu

Skip to content

Commit

Permalink
Add missing comparison operators
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannQDQ authored and nyalldawson committed Mar 29, 2023
1 parent b35d5fd commit c5e1ca5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/core/auto_generated/project/qgsprojectversion.sip.in
Expand Up @@ -71,6 +71,10 @@ Returns ``True`` if this is a NULL project version.

bool operator>( const QgsProjectVersion &other ) const;

bool operator<( const QgsProjectVersion &other ) const;

bool operator<=( const QgsProjectVersion &other ) const;

};

/************************************************************************
Expand Down
11 changes: 11 additions & 0 deletions src/core/project/qgsprojectversion.cpp
Expand Up @@ -74,6 +74,17 @@ bool QgsProjectVersion::operator>( const QgsProjectVersion &other ) const
( ( mMajor == other.mMajor ) && ( mMinor == other.mMinor ) && ( mSub > other.mSub ) ) );
}

bool QgsProjectVersion::operator<( const QgsProjectVersion &other ) const
{
return other > *this;
}

bool QgsProjectVersion::operator<=( const QgsProjectVersion &other ) const
{
return other >= *this;
}


QString QgsProjectVersion::text() const
{
if ( mName.isEmpty() )
Expand Down
10 changes: 10 additions & 0 deletions src/core/project/qgsprojectversion.h
Expand Up @@ -94,6 +94,16 @@ class CORE_EXPORT QgsProjectVersion
*/
bool operator>( const QgsProjectVersion &other ) const;

/**
* Boolean < operator
*/
bool operator<( const QgsProjectVersion &other ) const;

/**
* Boolean <= operator
*/
bool operator<=( const QgsProjectVersion &other ) const;

private:
int mMajor = 0;
int mMinor = 0;
Expand Down

0 comments on commit c5e1ca5

Please sign in to comment.