A semantic version implementation. Conforms to v2.0.0 of http://semver.org/
More...
|
| SemVersion (int major, int minor=0, int patch=0, string prerelease="", string build="") |
| Initializes a new instance of the SemVersion class. More...
|
|
| SemVersion (Version version) |
| Initializes a new instance of the SemVersion class. More...
|
|
SemVersion | Change (int? major=null, int? minor=null, int? patch=null, string prerelease=null, string build=null) |
| Make a copy of the current instance with optional altered fields. More...
|
|
override string | ToString () |
| Returns a System.String that represents this instance. More...
|
|
int | CompareTo (object obj) |
| Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. More...
|
|
int | CompareTo (SemVersion other) |
| Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. More...
|
|
bool | PrecedenceMatches (SemVersion other) |
| Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information. More...
|
|
int | CompareByPrecedence (SemVersion other) |
| Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information. More...
|
|
override bool | Equals (object obj) |
| Determines whether the specified System.Object is equal to this instance. More...
|
|
override int | GetHashCode () |
| Returns a hash code for this instance. More...
|
|
void | GetObjectData (SerializationInfo info, StreamingContext context) |
|
|
static SemVersion | Parse (string version, bool strict=false) |
| Parses the specified string to a semantic version. More...
|
|
static bool | TryParse (string version, out SemVersion semver, bool strict=false) |
| Parses the specified string to a semantic version. More...
|
|
static bool | Equals (SemVersion versionA, SemVersion versionB) |
| Tests the specified versions for equality. More...
|
|
static int | Compare (SemVersion versionA, SemVersion versionB) |
| Compares the specified versions. More...
|
|
static implicit | operator SemVersion (string version) |
| Implicit conversion from string to SemVersion. More...
|
|
static bool | operator== (SemVersion left, SemVersion right) |
| The override of the equals operator. More...
|
|
static bool | operator != (SemVersion left, SemVersion right) |
| The override of the un-equal operator. More...
|
|
static bool | operator > (SemVersion left, SemVersion right) |
| The override of the greater operator. More...
|
|
static bool | operator >= (SemVersion left, SemVersion right) |
| The override of the greater than or equal operator. More...
|
|
static bool | operator< (SemVersion left, SemVersion right) |
| The override of the less operator. More...
|
|
static bool | operator<= (SemVersion left, SemVersion right) |
| The override of the less than or equal operator. More...
|
|
|
static int | CompareComponent (string a, string b, bool lower=false) |
|
A semantic version implementation. Conforms to v2.0.0 of http://semver.org/
Definition at line 43 of file SemVersion.cs.
◆ SemVersion() [1/3]
Semver.SemVersion.SemVersion |
( |
SerializationInfo |
info, |
|
|
StreamingContext |
context |
|
) |
| |
|
inlineprivate |
◆ SemVersion() [2/3]
Semver.SemVersion.SemVersion |
( |
int |
major, |
|
|
int |
minor = 0 , |
|
|
int |
patch = 0 , |
|
|
string |
prerelease = "" , |
|
|
string |
build = "" |
|
) |
| |
|
inline |
Initializes a new instance of the SemVersion class.
- Parameters
-
major | The major version. |
minor | The minor version. |
patch | The patch version. |
prerelease | The prerelease version (eg. "alpha"). |
build | The build eg ("nightly.232"). |
Definition at line 85 of file SemVersion.cs.
◆ SemVersion() [3/3]
Semver.SemVersion.SemVersion |
( |
Version |
version | ) |
|
|
inline |
Initializes a new instance of the SemVersion class.
- Parameters
-
version | The System.Version that is used to initialize the Major, Minor, Patch and Build properties. |
Definition at line 100 of file SemVersion.cs.
◆ Change()
SemVersion Semver.SemVersion.Change |
( |
int? |
major = null , |
|
|
int? |
minor = null , |
|
|
int? |
patch = null , |
|
|
string |
prerelease = null , |
|
|
string |
build = null |
|
) |
| |
|
inline |
Make a copy of the current instance with optional altered fields.
- Parameters
-
major | The major version. |
minor | The minor version. |
patch | The patch version. |
prerelease | The prerelease text. |
build | The build text. |
- Returns
- The new version object.
Definition at line 241 of file SemVersion.cs.
◆ Compare()
Compares the specified versions.
- Parameters
-
versionA | The version to compare to. |
versionB | The version to compare against. |
- Returns
- If versionA < versionB
< 0
, if versionA > versionB > 0
, if versionA is equal to versionB 0
.
Definition at line 225 of file SemVersion.cs.
◆ CompareByPrecedence()
int Semver.SemVersion.CompareByPrecedence |
( |
SemVersion |
other | ) |
|
|
inline |
Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information.
- Parameters
-
other | The semantic version. |
- Returns
- A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes other in the version precedence. Zero This instance has the same precedence as other . i Greater than zero This instance has creater precedence as other .
Definition at line 373 of file SemVersion.cs.
◆ CompareTo() [1/2]
int Semver.SemVersion.CompareTo |
( |
object |
obj | ) |
|
|
inline |
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
- Parameters
-
obj | An object to compare with this instance. |
- Returns
- A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj . i Greater than zero This instance follows obj in the sort order.
Definition at line 321 of file SemVersion.cs.
◆ CompareTo() [2/2]
int Semver.SemVersion.CompareTo |
( |
SemVersion |
other | ) |
|
|
inline |
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
- Parameters
-
other | An object to compare with this instance. |
- Returns
- A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes other in the sort order. Zero This instance occurs in the same position in the sort order as other . i Greater than zero This instance follows other in the sort order.
Definition at line 339 of file SemVersion.cs.
◆ Equals() [1/2]
Tests the specified versions for equality.
- Parameters
-
versionA | The first version. |
versionB | The second version. |
- Returns
- If versionA is equal to versionB
true
, else false
.
Definition at line 211 of file SemVersion.cs.
◆ Equals() [2/2]
override bool Semver.SemVersion.Equals |
( |
object |
obj | ) |
|
|
inline |
Determines whether the specified System.Object is equal to this instance.
- Parameters
-
obj | The System.Object to compare with this instance. |
- Returns
true
if the specified System.Object is equal to this instance; otherwise, false
.
Definition at line 442 of file SemVersion.cs.
◆ GetHashCode()
override int Semver.SemVersion.GetHashCode |
( |
| ) |
|
|
inline |
Returns a hash code for this instance.
- Returns
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Definition at line 465 of file SemVersion.cs.
◆ operator !=()
The override of the un-equal operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is not equal to right
true
, else false
.
Definition at line 514 of file SemVersion.cs.
◆ operator >()
The override of the greater operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is greater than right
true
, else false
.
Definition at line 525 of file SemVersion.cs.
◆ operator >=()
The override of the greater than or equal operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is greater than or equal to right
true
, else false
.
Definition at line 536 of file SemVersion.cs.
◆ operator SemVersion()
static implicit Semver.SemVersion.operator SemVersion |
( |
string |
version | ) |
|
|
inlinestatic |
◆ operator<()
The override of the less operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is less than right
true
, else false
.
Definition at line 547 of file SemVersion.cs.
◆ operator<=()
The override of the less than or equal operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is less than or equal to right
true
, else false
.
Definition at line 558 of file SemVersion.cs.
◆ operator==()
The override of the equals operator.
- Parameters
-
left | The left value. |
right | The right value. |
- Returns
- If left is equal to right
true
, else false
.
Definition at line 503 of file SemVersion.cs.
◆ Parse()
static SemVersion Semver.SemVersion.Parse |
( |
string |
version, |
|
|
bool |
strict = false |
|
) |
| |
|
inlinestatic |
Parses the specified string to a semantic version.
- Parameters
-
version | The version string. |
strict | If set to true minor and patch version are required, else they default to 0. |
- Returns
- The SemVersion object.
- Exceptions
-
System.InvalidOperationException | When a invalid version string is passed. |
Definition at line 132 of file SemVersion.cs.
◆ PrecedenceMatches()
bool Semver.SemVersion.PrecedenceMatches |
( |
SemVersion |
other | ) |
|
|
inline |
Compares to semantic versions by precedence. This does the same as a Equals, but ignores the build information.
- Parameters
-
other | The semantic version. |
- Returns
true
if the version precedence matches.
Definition at line 357 of file SemVersion.cs.
◆ ToString()
override string Semver.SemVersion.ToString |
( |
| ) |
|
|
inline |
Returns a System.String that represents this instance.
- Returns
- A System.String that represents this instance.
Definition at line 298 of file SemVersion.cs.
◆ TryParse()
static bool Semver.SemVersion.TryParse |
( |
string |
version, |
|
|
out SemVersion |
semver, |
|
|
bool |
strict = false |
|
) |
| |
|
inlinestatic |
Parses the specified string to a semantic version.
- Parameters
-
version | The version string. |
semver | When the method returns, contains a SemVersion instance equivalent to the version string passed in, if the version string was valid, or null if the version string was not valid. |
strict | If set to true minor and patch version are required, else they default to 0. |
- Returns
False
when a invalid version string is passed, otherwise true
.
Definition at line 191 of file SemVersion.cs.
◆ parseEx
Regex Semver.SemVersion.parseEx |
|
staticprivate |
Initial value:=
new Regex(@"^(?<major>\d+)" +
@"(\.(?<minor>\d+))?" +
@"(\.(?<patch>\d+))?" +
@"(\-(?<pre>[0-9A-Za-z\-\.]+))?" +
@"(\+(?<build>[0-9A-Za-z\-\.]+))?$",
RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture)
Definition at line 46 of file SemVersion.cs.
◆ Build
string Semver.SemVersion.Build |
|
getprivate set |
Gets the build version.
The build version.
Definition at line 290 of file SemVersion.cs.
◆ Major
int Semver.SemVersion.Major |
|
getprivate set |
Gets the major version.
The major version.
Definition at line 258 of file SemVersion.cs.
◆ Minor
int Semver.SemVersion.Minor |
|
getprivate set |
Gets the minor version.
The minor version.
Definition at line 266 of file SemVersion.cs.
◆ Patch
int Semver.SemVersion.Patch |
|
getprivate set |
Gets the patch version.
The patch version.
Definition at line 274 of file SemVersion.cs.
◆ Prerelease
string Semver.SemVersion.Prerelease |
|
getprivate set |
Gets the pre-release version.
The pre-release version.
Definition at line 282 of file SemVersion.cs.
The documentation for this class was generated from the following file:
- Library/PackageCache/com.unity.package-manager-ui@2.0.7/Editor/Sources/External/SemVersion.cs