Full semver 2.0.0 implementation and validation by a number of tests.
This commit is contained in:
+20
-11
@@ -24,25 +24,25 @@ SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace version {
|
||||
|
||||
enum class Identifier_type { alnum, num };
|
||||
|
||||
using Prerelease_identifier = std::pair<std::string, Identifier_type>;
|
||||
using Prerelease_identifiers = std::vector<Prerelease_identifier>;
|
||||
using Build_identifier = std::string;
|
||||
using Build_identifiers = std::vector<Build_identifier>;
|
||||
|
||||
struct Version_data {
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
std::string release;
|
||||
std::string build;
|
||||
};
|
||||
|
||||
struct Semver200_parser {
|
||||
Version_data parse(const std::string&);
|
||||
};
|
||||
|
||||
struct Semver200_comparator {
|
||||
int compare(const Version_data&, const Version_data&);
|
||||
Prerelease_identifiers prerelease_ids;
|
||||
Build_identifiers build_ids;
|
||||
};
|
||||
|
||||
template<typename Parser, typename Comparator>
|
||||
@@ -63,9 +63,18 @@ namespace version {
|
||||
const Version_data ver_;
|
||||
};
|
||||
|
||||
struct Semver200_parser {
|
||||
Version_data parse(const std::string&);
|
||||
};
|
||||
|
||||
struct Semver200_comparator {
|
||||
int compare(const Version_data&, const Version_data&);
|
||||
};
|
||||
|
||||
class Semver200 : public Basic_version<Semver200_parser, Semver200_comparator> {};
|
||||
|
||||
class Parse_error : public std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user