BPackageVersion: Add comparison operators
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user