BPackageVersion: Add comparison operators
This commit is contained in:
@@ -51,6 +51,13 @@ public:
|
|||||||
// does a natural compare over major, minor
|
// does a natural compare over major, minor
|
||||||
// and micro, finally comparing revision
|
// 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:
|
private:
|
||||||
BString fMajor;
|
BString fMajor;
|
||||||
BString fMinor;
|
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
|
} // namespace BPackageKit
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user