![]() |
xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <version.h>
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inherited.
major.minor[.build[.revision]]
Inherits xtd::object, and xtd::icomparable< version >.
Public Member Functions | |
| version () noexcept=default | |
| Initializes a new instance of the xtd::version class. More... | |
| version (const xtd::ustring &version) | |
| Initializes a new instance of the xtd::version class using the specified string. More... | |
| version (int32_t major, int32_t minor) | |
| Initializes a new instance of the xtd::version class using the specified major and minor values. More... | |
| version (int32_t major, int32_t minor, int32_t build) | |
| Initializes a new instance of the xtd::version class using the specified major, minor and build values. More... | |
| version (int32_t major, int32_t minor, int32_t build, int32_t revision) | |
| Initializes a new instance of the xtd::version class using the specified major, minor, build and revision values. More... | |
| int32_t | build () const noexcept |
| Gets the value of the build component of the version number for the current xtd::version object. More... | |
| int32_t | compare_to (const object &version) const noexcept override |
| Compares the current xtd::version object to a specified object and returns an indication of their relative values. More... | |
| int32_t | compare_to (const version &version) const noexcept override |
| Compares the current xtd::version object to a specified object and returns an indication of their relative values. More... | |
| int32_t | major () const noexcept |
| Gets the value of the major component of the version number for the current xtd::version object. More... | |
| int16_t | major_revision () const noexcept |
| Gets the high 16 bits of the revision number. More... | |
| int32_t | minor () const noexcept |
| Gets the value of the minor component of the version number for the current xtd::version object. More... | |
| int16_t | minor_revision () const noexcept |
| Gets the low 16 bits of the revision number. More... | |
| int32_t | revision () const noexcept |
| Gets the value of the revision component of the version number for the current xtd::version object. More... | |
| xtd::ustring | to_string () const noexcept override |
| Converts the value of the current xtd::version object to its equivalent xtd::ustring representation. More... | |
| xtd::ustring | to_string (size_t field_count) const |
| Converts the value of the current xtd::version object to its equivalent xtd::ustring representation. A specified count indicates the number of components to return. More... | |
Public Member Functions inherited from xtd::object | |
| object ()=default | |
| Create a new instance of the ultimate base class object. More... | |
| virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object. More... | |
| virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. More... | |
| template<typename object_t > | |
| std::unique_ptr< object_t > | memberwise_clone () const |
| Gets the type of the current instance. More... | |
Static Public Member Functions | |
| static version | parse (const xtd::ustring &input) |
| Converts the string representation of a version number to an equivalent Version object. More... | |
| static bool | try_parse (const xtd::ustring &input, version &result) noexcept |
| Tries to convert the string representation of a version number to an equivalent xtd::version object, and returns a value that indicates whether the conversion succeeded. More... | |
Static Public Member Functions inherited from xtd::object | |
| static bool | equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are considered equal. More... | |
| static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are the same instance. More... | |
|
defaultnoexcept |
Initializes a new instance of the xtd::version class.
| Property | Value |
|---|---|
| xtd::version::major | 0 |
| xtd::version::minor | 0 |
| xtd::version::build | -1 |
| xtd::version::revision | -1 |
| xtd::version::version | ( | const xtd::ustring & | version | ) |
Initializes a new instance of the xtd::version class using the specified string.
| version | A string containing the major, minor, build, and revision numbers, where each number is delimited with a period character ('.'). |
| xtd::argument_exception | version has fewer than two components or more than four components. |
| xtd::argument_out_of_range_exception | A major, minor, build, or revision component is less than zero. |
| xtd::format_exception | At least one component of version does not parse to an integer. |
| xtd::overflow_exception | At least one component of version represents a number greater than std::numeric_limits<int32_t>::max(). |
major.minor[.build[.revision]]
| xtd::version::version | ( | int32_t | major, |
| int32_t | minor | ||
| ) |
Initializes a new instance of the xtd::version class using the specified major and minor values.
| major | The major version number. |
| minor | The minor version number. |
| xtd::out_of_range_exception | major or minor is less than zero. |
| Property | Value |
|---|---|
| xtd::version::major | major |
| xtd::version::minor | minor |
| xtd::version::build | undefined (-1) |
| xtd::version::revision | undefined (-1) |
| xtd::version::version | ( | int32_t | major, |
| int32_t | minor, | ||
| int32_t | build | ||
| ) |
Initializes a new instance of the xtd::version class using the specified major, minor and build values.
| major | The major version number. |
| minor | The minor version number. |
| build | The build version number. |
| xtd::out_of_range_exception | major, minor or build is less than zero. |
| Property | Value |
|---|---|
| xtd::version::major | major |
| xtd::version::minor | minor |
| xtd::version::build | build |
| xtd::version::revision | undefined (-1) |
| xtd::version::version | ( | int32_t | major, |
| int32_t | minor, | ||
| int32_t | build, | ||
| int32_t | revision | ||
| ) |
Initializes a new instance of the xtd::version class using the specified major, minor, build and revision values.
| major | The major version number. |
| minor | The minor version number. |
| build | The build version number. |
| revision | The revision version number. |
| xtd::out_of_range_exception | major, minor, build or revision is less than zero. |
| Property | Value |
|---|---|
| xtd::version::major | major |
| xtd::version::minor | minor |
| xtd::version::build | build |
| xtd::version::revision | revision |
|
noexcept |
Gets the value of the build component of the version number for the current xtd::version object.
|
overridevirtualnoexcept |
Compares the current xtd::version object to a specified object and returns an indication of their relative values.
| version | An object to compare. |
| Return value | Meaning |
|---|---|
| Less than zero | The current xtd::version object is a version before version. |
| Zero | The current xtd::version object is the same version as version. |
| Greater than zero | The current xtd::version object is a version subsequent to version or version is not ta xtd::version object. |
Reimplemented from xtd::icomparable< version >.
|
overridevirtualnoexcept |
Compares the current xtd::version object to a specified object and returns an indication of their relative values.
| version | An object to compare. |
| Return value | Meaning |
|---|---|
| Less than zero | The current xtd::version object is a version before version. |
| Zero | The current xtd::version object is the same version as version. |
| Greater than zero | The current xtd::version object is a version subsequent to version. |
Implements xtd::icomparable< version >.
|
noexcept |
Gets the value of the major component of the version number for the current xtd::version object.
|
noexcept |
Gets the high 16 bits of the revision number.
|
noexcept |
Gets the value of the minor component of the version number for the current xtd::version object.
|
noexcept |
Gets the low 16 bits of the revision number.
|
static |
Converts the string representation of a version number to an equivalent Version object.
| input | A string that contains a version number to convert. |
| xtd::argument_out_of_range_exception | A major, minor, build, or revision component is less than zero. |
| xtd::format_exception | At least one component of input does not parse to an integer. |
| xtd::overflow_exception | At least one component of input represents a number greater than std::numeric_limits<int32_t>::max(). |
major.minor[.build[.revision]]
|
noexcept |
Gets the value of the revision component of the version number for the current xtd::version object.
|
overridevirtualnoexcept |
Converts the value of the current xtd::version object to its equivalent xtd::ustring representation.
major.minor[.build[.revision]]For example, if you create a xtd::version object using the constructor xtd::version(1, 1), the returned string is "1.1". If you create a xtd::version object using the constructor xtd::version(1, 3, 4, 2), the returned string is "1.3.4.2".
Reimplemented from xtd::object.
| xtd::ustring xtd::version::to_string | ( | size_t | field_count | ) | const |
Converts the value of the current xtd::version object to its equivalent xtd::ustring representation. A specified count indicates the number of components to return.
| field_count | The number of components to return. The field_count ranges from 0 to 4. |
| field_count | Return Value |
|---|---|
| 0 | An empty string (""). |
| 1 | major |
| 2 | major.minor |
| 3 | major.minor.build |
| 4 | major.minor.build.revision |
| xtd::argument_exception | field_count is more than 4 -or- field_count is more than the number of components defined in the current xtd::version object. |
|
staticnoexcept |
Tries to convert the string representation of a version number to an equivalent xtd::version object, and returns a value that indicates whether the conversion succeeded.
| input | A string that contains a version number to convert. |
| result | When this method returns, contains the xtd::version equivalent of the number that is contained in input, if the conversion succeeded. If input is empty, or if the conversion fails, result is empty when the method returns. |
major.minor[.build[.revision]]where major, minor, build, and revision are the string representations of the version number's four components: major version number, minor version number, build number, and revision number, respectively. Optional components are shown in square brackets ([ and ]). The components must appear in order and must be separated by periods.