diff options
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/versions.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg/versions.h b/toolsrc/include/vcpkg/versions.h index 09df15366..19b5546ea 100644 --- a/toolsrc/include/vcpkg/versions.h +++ b/toolsrc/include/vcpkg/versions.h @@ -6,6 +6,14 @@ namespace vcpkg::Versions { using Version = VersionT; + enum class VerComp + { + unk, + lt, + eq, + gt, + }; + enum class Scheme { Relaxed, @@ -32,6 +40,42 @@ namespace vcpkg::Versions std::size_t operator()(const VersionSpec& key) const; }; + struct RelaxedVersion + { + std::string original_string; + std::vector<uint64_t> version; + + static ExpectedS<RelaxedVersion> from_string(const std::string& str); + }; + + struct SemanticVersion + { + std::string original_string; + std::string version_string; + std::string prerelease_string; + + std::vector<uint64_t> version; + std::vector<std::string> identifiers; + + static ExpectedS<SemanticVersion> from_string(const std::string& str); + }; + + struct DateVersion + { + std::string original_string; + std::string version_string; + std::string identifiers_string; + + std::vector<uint64_t> identifiers; + + static ExpectedS<DateVersion> from_string(const std::string& str); + }; + + VerComp compare(const std::string& a, const std::string& b, Scheme scheme); + VerComp compare(const RelaxedVersion& a, const RelaxedVersion& b); + VerComp compare(const SemanticVersion& a, const SemanticVersion& b); + VerComp compare(const DateVersion& a, const DateVersion& b); + struct Constraint { enum class Type |
