BPackageVersion: Add comparison operators

This commit is contained in:
Ingo Weinhold
2013-11-27 15:38:41 +01:00
parent ecd7a82e0d
commit f96ed66270
+49
View File
@@ -51,6 +51,13 @@ public:
// does a natural compare over major, minor
// and micro, finally comparing revision
inline bool operator==(const BPackageVersion& other) const;
inline bool operator!=(const BPackageVersion& other) const;
inline bool operator<(const BPackageVersion& other) const;
inline bool operator>(const BPackageVersion& other) const;
inline bool operator<=(const BPackageVersion& other) const;
inline bool operator>=(const BPackageVersion& other) const;
private:
BString fMajor;
BString fMinor;
@@ -60,6 +67,48 @@ private:
};
inline bool
BPackageVersion::operator==(const BPackageVersion& other) const
{
return Compare(other) == 0;
}
inline bool
BPackageVersion::operator!=(const BPackageVersion& other) const
{
return Compare(other) != 0;
}
inline bool
BPackageVersion::operator<(const BPackageVersion& other) const
{
return Compare(other) < 0;
}
inline bool
BPackageVersion::operator>(const BPackageVersion& other) const
{
return Compare(other) > 0;
}
inline bool
BPackageVersion::operator<=(const BPackageVersion& other) const
{
return Compare(other) <= 0;
}
inline bool
BPackageVersion::operator>=(const BPackageVersion& other) const
{
return Compare(other) >= 0;
}
} // namespace BPackageKit