19 #include <QStringList>
34 const QString pre =
string.section(
'-', 0, 0 );
35 const QStringList fileVersionParts = pre.section(
'-', 0 ).split(
'.' );
37 mMajor = fileVersionParts.at( 0 ).toInt();
38 if ( fileVersionParts.size() > 1 )
40 mMinor = fileVersionParts.at( 1 ).toInt();
42 if ( fileVersionParts.size() > 2 )
44 mSub = fileVersionParts.at( 2 ).toInt();
46 mName =
string.section(
'-', 1 );
53 return ( ( mMajor == other.mMajor ) &&
54 ( mMinor == other.mMinor ) &&
55 ( mSub == other.mSub ) );
60 return ( ( mMajor != other.mMajor ) ||
61 ( mMinor != other.mMinor ) ||
62 ( mSub != other.mSub ) );
67 return ( *
this == other ) || ( *
this > other );
72 return ( ( mMajor > other.mMajor ) ||
73 ( ( mMajor == other.mMajor ) && ( mMinor > other.mMinor ) ) ||
74 ( ( mMajor == other.mMajor ) && ( mMinor == other.mMinor ) && ( mSub > other.mSub ) ) );
79 if ( mName.isEmpty() )
81 return QStringLiteral(
"%1.%2.%3" ).arg( mMajor ).arg( mMinor ).arg( mSub );
85 return QStringLiteral(
"%1.%2.%3-%4" ).arg( mMajor ).arg( mMinor ).arg( mSub ).arg( mName );
91 return mMajor == 0 && mMinor == 0 && mSub == 0;
A class to describe the version of a project.
bool operator>(const QgsProjectVersion &other) const
Boolean > operator.
bool operator!=(const QgsProjectVersion &other) const
Boolean not equal operator.
QString text() const
Returns a string representation of the version.
bool operator==(const QgsProjectVersion &other) const
Boolean equal operator.
bool operator>=(const QgsProjectVersion &other) const
Boolean >= operator.
bool isNull() const
Returns true if this is a NULL project version.
QgsProjectVersion()=default
Creates a new NULL version.
#define QgsDebugMsgLevel(str, level)