DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DotNetDupe::System::Version Class Reference

Represents the version number for an assembly, operating system, or component. More...

#include <Version.h>

Inheritance diagram for DotNetDupe::System::Version:

Public Member Functions

 Version ()
 Initializes a new instance of the Version class to 0.0.0.0.
 Version (int iMajor, int iMinor)
 Initializes a new instance of the Version class using specified major and minor numbers.
 Version (int iMajor, int iMinor, int iBuild)
 Initializes a new instance of the Version class using specified major, minor, and build numbers.
 Version (int iMajor, int iMinor, int iBuild, int iRevision)
 Initializes a new instance of the Version class using specified major, minor, build, and revision numbers.
int GetBuild () const
 Gets the value of the build component of the version number.
int GetMajor () const
 Gets the value of the major component of the version number.
int GetMinor () const
 Gets the value of the minor component of the version number.
int GetRevision () const
 Gets the value of the revision component of the version number.
bool operator!= (const Version &vOther) const
 Determines whether two Version instances are not equal.
bool operator== (const Version &vOther) const
 Determines whether two Version instances are equal.
String ToString () const
 Converts the value of the current Version object to its equivalent String representation.
Public Member Functions inherited from DotNetDupe::System::Object
virtual ~Object ()=default
 Virtual destructor ensuring polymorphic cleanup.
virtual bool Equals (const Object &obj) const
 Determines whether the specified Object is equal to the current Object.
virtual int GetHashCode () const
 Serves as the default hash function.
bool operator== (const Object &obj) const
 Determines reference equality between two objects.
char * ToStringA () const
 Returns narrow-character string representation.
wchar_t * ToStringW () const
 Returns wide-character string representation.

Static Public Member Functions

static Version Parse (const String &sInput)
 Converts the string representation of a version number to an equivalent Version object.
static bool TryParse (const String &sInput, Version &vResult)
 Tries to convert the string representation of a version number to an equivalent Version object.
Static Public Member Functions inherited from DotNetDupe::System::Object
static bool Equals (const Object &obj1, const Object &obj2)
 Static helper determining whether two object instances are equal.

Detailed Description

Represents the version number for an assembly, operating system, or component.

Conforms to .NET System.Version with 2, 3, or 4 component formats: major.minor[.build[.revision]]. Immutable once constructed and thread-safe for concurrent read access.

Note
Conforms to ECMA-335 Partition IV Section 5.6 (System.Version).
See also
String, Environment

Definition at line 20 of file Version.h.

Constructor & Destructor Documentation

◆ Version() [1/4]

DotNetDupe::System::Version::Version ( int iMajor,
int iMinor,
int iBuild,
int iRevision )

Initializes a new instance of the Version class using specified major, minor, build, and revision numbers.

Parameters
iMajorThe major version component.
iMinorThe minor version component.
iBuildThe build version component.
iRevisionThe revision version component.

Definition at line 68 of file Version.cpp.

Referenced by operator!=(), operator==(), Parse(), and TryParse().

◆ Version() [2/4]

DotNetDupe::System::Version::Version ( int iMajor,
int iMinor,
int iBuild )

Initializes a new instance of the Version class using specified major, minor, and build numbers.

Parameters
iMajorThe major version component.
iMinorThe minor version component.
iBuildThe build version component.

Definition at line 71 of file Version.cpp.

◆ Version() [3/4]

DotNetDupe::System::Version::Version ( int iMajor,
int iMinor )

Initializes a new instance of the Version class using specified major and minor numbers.

Parameters
iMajorThe major version component.
iMinorThe minor version component.

Definition at line 74 of file Version.cpp.

◆ Version() [4/4]

DotNetDupe::System::Version::Version ( )

Initializes a new instance of the Version class to 0.0.0.0.

Definition at line 77 of file Version.cpp.

Referenced by DotNetDupe::System::Environment::GetOperatingSystem(), and TryParse().

Member Function Documentation

◆ GetBuild()

int DotNetDupe::System::Version::GetBuild ( ) const

Gets the value of the build component of the version number.

Returns
An integer representing the build version number.

Definition at line 88 of file Version.cpp.

◆ GetMajor()

int DotNetDupe::System::Version::GetMajor ( ) const

Gets the value of the major component of the version number.

Returns
An integer representing the major version number.

Definition at line 80 of file Version.cpp.

◆ GetMinor()

int DotNetDupe::System::Version::GetMinor ( ) const

Gets the value of the minor component of the version number.

Returns
An integer representing the minor version number.

Definition at line 84 of file Version.cpp.

◆ GetRevision()

int DotNetDupe::System::Version::GetRevision ( ) const

Gets the value of the revision component of the version number.

Returns
An integer representing the revision version number.

Definition at line 92 of file Version.cpp.

◆ operator!=()

bool DotNetDupe::System::Version::operator!= ( const Version & vOther) const

Determines whether two Version instances are not equal.

Parameters
vOtherThe Version instance to compare with the current instance.
Returns
True if any version component differs; otherwise, false.

Definition at line 131 of file Version.cpp.

References Version().

◆ operator==()

bool DotNetDupe::System::Version::operator== ( const Version & vOther) const

Determines whether two Version instances are equal.

Parameters
vOtherThe Version instance to compare with the current instance.
Returns
True if all version components match; otherwise, false.

Definition at line 124 of file Version.cpp.

References Version().

◆ Parse()

Version DotNetDupe::System::Version::Parse ( const String & sInput)
static

Converts the string representation of a version number to an equivalent Version object.

Parameters
sInputString containing 2 to 4 integer components separated by dots.
Returns
A Version object equivalent to the string representation.
Exceptions
ArgumentExceptionThrown when string format is invalid or component values are out of range.

Definition at line 102 of file Version.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException(), DotNetDupe::System::FormatException::FormatException(), Version(), DotNetDupe::System::String::IsEmpty(), and TryParse().

◆ ToString()

String DotNetDupe::System::Version::ToString ( ) const

Converts the value of the current Version object to its equivalent String representation.

Returns
A string representation of the version in major.minor.build.revision format.

Definition at line 96 of file Version.cpp.

References DotNetDupe::System::String::String().

◆ TryParse()

bool DotNetDupe::System::Version::TryParse ( const String & sInput,
Version & vResult )
static

Tries to convert the string representation of a version number to an equivalent Version object.

Parameters
sInputString containing the version representation.
vResultOutput Version instance populated on success.
Returns
True if parsing succeeded; otherwise, false.

Definition at line 113 of file Version.cpp.

References Version(), Version(), and DotNetDupe::System::TryParseInternal().

Referenced by Parse().


The documentation for this class was generated from the following files: