Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions toolsrc/include/vcpkg/versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ namespace vcpkg::Versions
{
using Version = VersionT;

enum class VerComp
{
unk,
lt,
eq,
gt,
};

enum class Scheme
{
Relaxed,
Expand All @@ -32,6 +40,45 @@ namespace vcpkg::Versions
std::size_t operator()(const VersionSpec& key) const;
};

struct RelaxedVersion
{
std::string original_string;
std::vector<long> version;

static ExpectedS<RelaxedVersion> from_string(const std::string& str);
static RelaxedVersion try_from_string(const std::string& str);
};

struct SemanticVersion
{
std::string original_string;
std::string version_string;
std::string prerelease_string;

std::vector<long> version;
std::vector<std::string> identifiers;

static ExpectedS<SemanticVersion> from_string(const std::string& str);
static SemanticVersion try_from_string(const std::string& str);
};

struct DateVersion
{
std::string original_string;
std::string version_string;
std::string identifiers_string;

std::vector<long> identifiers;

static ExpectedS<DateVersion> from_string(const std::string& str);
static DateVersion try_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
Expand Down
Loading