format ContentPackVersion
This commit is contained in:
@@ -37,7 +37,8 @@ DependencyVersionOperator Version::string_to_operator(const std::string& op) {
|
|||||||
return DependencyVersionOperator::more_or_equal;
|
return DependencyVersionOperator::more_or_equal;
|
||||||
else if (op == "<=" || op == "=<")
|
else if (op == "<=" || op == "=<")
|
||||||
return DependencyVersionOperator::less_or_equal;
|
return DependencyVersionOperator::less_or_equal;
|
||||||
else return DependencyVersionOperator::equal;
|
else
|
||||||
|
return DependencyVersionOperator::equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNumber(const std::string& s) {
|
bool isNumber(const std::string& s) {
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ class Version {
|
|||||||
Version(const std::string& version);
|
Version(const std::string& version);
|
||||||
|
|
||||||
bool operator==(const Version& other) const {
|
bool operator==(const Version& other) const {
|
||||||
return major == other.major && minor == other.minor && patch == other.patch;
|
return major == other.major && minor == other.minor &&
|
||||||
|
patch == other.patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const Version& other) const {
|
bool operator<(const Version& other) const {
|
||||||
@@ -20,7 +21,6 @@ class Version {
|
|||||||
return patch < other.patch;
|
return patch < other.patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator>(const Version& other) const {
|
bool operator>(const Version& other) const {
|
||||||
return other < *this;
|
return other < *this;
|
||||||
}
|
}
|
||||||
@@ -37,12 +37,18 @@ class Version {
|
|||||||
auto dep_op = Version::string_to_operator(op);
|
auto dep_op = Version::string_to_operator(op);
|
||||||
|
|
||||||
switch (dep_op) {
|
switch (dep_op) {
|
||||||
case DependencyVersionOperator::equal: return *this == other;
|
case DependencyVersionOperator::equal:
|
||||||
case DependencyVersionOperator::more: return *this > other;
|
return *this == other;
|
||||||
case DependencyVersionOperator::less: return *this < other;
|
case DependencyVersionOperator::more:
|
||||||
case DependencyVersionOperator::less_or_equal: return *this <= other;
|
return *this > other;
|
||||||
case DependencyVersionOperator::more_or_equal: return *this >= other;
|
case DependencyVersionOperator::less:
|
||||||
default: return false;
|
return *this < other;
|
||||||
|
case DependencyVersionOperator::less_or_equal:
|
||||||
|
return *this <= other;
|
||||||
|
case DependencyVersionOperator::more_or_equal:
|
||||||
|
return *this >= other;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user