module watt.text.semver
Parse Semantic Version strings.
Semver is very simple, and so is this module.
Example
a := new Release("1.0.0+ubuntu");
b := new Release("1.0.0+win32");
c := new Release("1.2.3+ubuntu");
assert(a == b);
assert(c > a && c > b);
Code Map
//! Parse Semantic Version strings.
module watt.text.semver;
//! Parses a string into a Semantic Version.
class Release
{
public:
//! major>..(-)(+)
major: i32;
minor: i32;
patch: i32;
prerelease: string;
metadata: string;
public:
//! Parse a SemVer from a given string.
this(verString: string) { }
//! Get a string representation of this semver string.
fn toString() string { }
//! Compare this release to another.
fn opCmp(b: Release) i32 { }
//! Test this release for equality with another.
fn opEquals(b: Release) bool { }
public:
static fn isValid(verString: string) bool { }
}
class Release
Parses a string into a Semantic Version.
major: i32
major>.
this(verString: string)
Parse a SemVer from a given string.
Throws
-
Exception
on malformed input.
fn isValid(verString: string) bool
Return
true
if the given string
is a valid semver string
.
fn toString() string
Get a string representation of this semver string.
The format is as follows: major.minor.patch(-prerelease)(+metadata)
fn opCmp(b: Release) i32
Compare this release to another.
First major
is checked, then minor
, then patch
.
If they all match, then prelease
is compared.
fn opEquals(b: Release) bool
Test this release for equality with another.
Two versions are equal if everything but their metadata matches.