mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-18 09:10:17 -05:00
fix version comparisons
This commit is contained in:
parent
ed02c8a893
commit
0f19f09a32
1 changed files with 32 additions and 4 deletions
|
@ -56,8 +56,8 @@ namespace geode {
|
||||||
constexpr bool operator>(VersionTag const& other) const {
|
constexpr bool operator>(VersionTag const& other) const {
|
||||||
if (value == other.value) {
|
if (value == other.value) {
|
||||||
if (number && other.number) return number > other.number;
|
if (number && other.number) return number > other.number;
|
||||||
if (number) return true;
|
if (number) return false;
|
||||||
if (other.number) return false;
|
if (other.number) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return value > other.value;
|
return value > other.value;
|
||||||
|
@ -65,8 +65,8 @@ namespace geode {
|
||||||
constexpr bool operator>=(VersionTag const& other) const {
|
constexpr bool operator>=(VersionTag const& other) const {
|
||||||
if (value == other.value) {
|
if (value == other.value) {
|
||||||
if (number && other.number) return number >= other.number;
|
if (number && other.number) return number >= other.number;
|
||||||
if (number) return true;
|
if (number) return false;
|
||||||
if (other.number) return false;
|
if (other.number) return true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return value >= other.value;
|
return value >= other.value;
|
||||||
|
@ -77,6 +77,34 @@ namespace geode {
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr bool operator<(std::optional<VersionTag> const& a, std::optional<VersionTag> const& b) {
|
||||||
|
if (a && b) return a < b;
|
||||||
|
if (a) return true;
|
||||||
|
if (b) return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool operator<=(std::optional<VersionTag> const& a, std::optional<VersionTag> const& b) {
|
||||||
|
if (a && b) return a <= b;
|
||||||
|
if (a) return true;
|
||||||
|
if (b) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool operator>(std::optional<VersionTag> const& a, std::optional<VersionTag> const& b) {
|
||||||
|
if (a && b) return a > b;
|
||||||
|
if (a) return false;
|
||||||
|
if (b) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool operator>=(std::optional<VersionTag> const& a, std::optional<VersionTag> const& b) {
|
||||||
|
if (a && b) return a >= b;
|
||||||
|
if (a) return false;
|
||||||
|
if (b) return true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing version information. Uses a limited subset of SemVer;
|
* Class representing version information. Uses a limited subset of SemVer;
|
||||||
* identifiers are restricted to a few predefined ones, and only one
|
* identifiers are restricted to a few predefined ones, and only one
|
||||||
|
|
Loading…
Reference in a new issue