OpenTAP 9.27
API Reference
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
OpenTap.Package.VersionSpecifier Class Reference

Specifies parts of a semantic version. This is used in PackageSpecifier to represent the part of a SemanticVersion to search for. E.g. the VersionSpecifier "9.0" may match the semantic version "9.0.4+abcdef" and also "9.1.x" if MatchBehavior is set to "Compatible". More...

Inherits IComparable.

Public Member Functions

 VersionSpecifier (int? major, int? minor, int? patch, string prerelease, string buildMetadata, VersionMatchBehavior matchBehavior)
 Specifies parts of a semantic version. Unset parameters will be treated as 'any'.
 
 VersionSpecifier (SemanticVersion ver, VersionMatchBehavior matchBehavior)
 Creates a VersionSpecifier from a SemanticVersion.
 
override string ToString ()
 Converts this value to a string. This string can be parsed by Parse(string) and TryParse(string, out VersionSpecifier).
 
string ToString (int fieldCount)
 Prints the string in version format. It should be parsable from the same string. More...
 
bool IsCompatible (SemanticVersion actualVersion)
 Compatibility comparison that returns true if the given version can fulfil this specification. I.e. 'actualVersion' can replace 'this' in every respect. More...
 
override int GetHashCode ()
 Gets the hash code of this value.
 
override bool Equals (object obj)
 Compares this VersionSpecifier with another object.
 
int CompareTo (object obj)
 Returns -1 if obj is greater than this version, 0 if they are the same, and 1 if this is greater than obj More...
 

Static Public Member Functions

static bool TryParse (string version, out VersionSpecifier ver)
 Parses a string as a VersionSpecifier.
 
static VersionSpecifier Parse (string version)
 Parses a string as a VersionSpecifier. More...
 
static bool operator== (VersionSpecifier a, VersionSpecifier b)
 Overloaded == operator that provides value equality (instead of the default reference equality)
 
static bool operator!= (VersionSpecifier a, VersionSpecifier b)
 Overloaded != operator that provides value equality (instead of the default reference equality)
 

Public Attributes

readonly? int Major
 Major version. When not null, SemanticVersion.IsCompatible will return false for SemanticVersions with a Major version different from this.
 
readonly? int Minor
 Minor version. When not null, SemanticVersion.IsCompatible will return false for SemanticVersions with a Minor version less than this (with VersionMatchBehavior.Compatible) or different from this (with VersionMatchBehavior.Exact).
 
readonly? int Patch
 Patch version. When not null, SemanticVersion.IsCompatible will return false for SemanticVersions with a Patch version different from this if MatchBehavior is VersionMatchBehavior.Exact.
 
readonly string PreRelease
 PreRelease identifier. SemanticVersion.IsCompatible will return false for SemanticVersions with a PreRelease less than this (with VersionMatchBehavior.Compatible) or different from this (with VersionMatchBehavior.Exact).
 
readonly string BuildMetadata
 BuildMetadata identifier. When not null, SemanticVersion.IsCompatible will return false for SemanticVersions with a BuildMetadata different from this if MatchBehavior is VersionMatchBehavior.Exact.
 
readonly VersionMatchBehavior MatchBehavior
 The way matching is done. This affects the behavior of SemanticVersion.IsCompatible(SemanticVersion).
 

Static Public Attributes

static readonly VersionSpecifier Any = new VersionSpecifier(null, null, null, null, null, VersionMatchBehavior.Exact | VersionMatchBehavior.AnyPrerelease)
 The VersionSpecifier that will match any version. VersionSpecifier.Any.IsCompatible always returns true.
 
static readonly VersionSpecifier AnyRelease = new VersionSpecifier(null, null, null, null, null, VersionMatchBehavior.Exact)
 The VersionSpecifier that will match any version. VersionSpecifier.Any.IsCompatible always returns true.
 

Detailed Description

Specifies parts of a semantic version. This is used in PackageSpecifier to represent the part of a SemanticVersion to search for. E.g. the VersionSpecifier "9.0" may match the semantic version "9.0.4+abcdef" and also "9.1.x" if MatchBehavior is set to "Compatible".

Member Function Documentation

◆ CompareTo()

int OpenTap.Package.VersionSpecifier.CompareTo ( object  obj)
inline

Returns -1 if obj is greater than this version, 0 if they are the same, and 1 if this is greater than obj

Parameters
obj
Returns

◆ IsCompatible()

bool OpenTap.Package.VersionSpecifier.IsCompatible ( SemanticVersion  actualVersion)
inline

Compatibility comparison that returns true if the given version can fulfil this specification. I.e. 'actualVersion' can replace 'this' in every respect.

Parameters
actualVersion
Returns

◆ Parse()

static VersionSpecifier OpenTap.Package.VersionSpecifier.Parse ( string  version)
inlinestatic

Parses a string as a VersionSpecifier.

Exceptions
FormatExceptionThe string is not a valid version specifier.

◆ ToString()

string OpenTap.Package.VersionSpecifier.ToString ( int  fieldCount)
inline

Prints the string in version format. It should be parsable from the same string.

Parameters
fieldCountNumber of values to return. Must be 1, 2, 4 or 5.
Exceptions
ArgumentOutOfRangeException
Returns

OpenTAP 9.27 API built Wed Nov 27 2024 13:14:46