Public Member Functions | |
VersionNumber () noexcept=default | |
VersionNumber (int major, std::string const &suffix="") | |
VersionNumber (int major, int minor, std::string const &suffix="") | |
VersionNumber (int major, int minor, int micro, std::string const &suffix="") | |
VersionNumber (std::initializer_list< int > args, std::string const &suffix="") | |
VersionNumber (std::vector< int > segments, std::string const &suffix="") | |
VersionNumber (std::string const &str) | |
VersionNumber (const char *str) | |
bool | isNormalized () const |
bool | isNull () const |
bool | isPrefixOf (VersionNumber const &other) const |
Returns true if the current version number is contained in the other version number, otherwise returns false. More... | |
int | majorVersion () const |
int | minorVersion () const |
int | microVersion () const |
auto | suffix () const -> std::string |
auto | normalized () const -> VersionNumber |
Returns an equivalent version number but with all trailing zeros removed. More... | |
int | segmentAt (int index) const |
int | segmentCount () const |
auto | segments () const -> std::vector< int > const & |
auto | toString (bool withSuffix=false) const -> std::string |
Static Public Member Functions | |
static auto | commonPrefix (VersionNumber const &v1, VersionNumber const &v2) -> VersionNumber |
static int | compare (VersionNumber const &v1, VersionNumber const &v2) noexcept |
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero, depending on whether v1 is less than, equal to, or greater than v2, respectively. More... | |
static auto | fromString (std::string const &str) -> VersionNumber |
|
defaultnoexcept |
VersionNumber::VersionNumber | ( | int | major, |
std::string const & | suffix = "" |
||
) |
VersionNumber::VersionNumber | ( | int | major, |
int | minor, | ||
std::string const & | suffix = "" |
||
) |
VersionNumber::VersionNumber | ( | int | major, |
int | minor, | ||
int | micro, | ||
std::string const & | suffix = "" |
||
) |
VersionNumber::VersionNumber | ( | std::initializer_list< int > | args, |
std::string const & | suffix = "" |
||
) |
|
explicit |
VersionNumber::VersionNumber | ( | std::string const & | str | ) |
VersionNumber::VersionNumber | ( | const char * | str | ) |
bool VersionNumber::isNormalized | ( | ) | const |
bool VersionNumber::isNull | ( | ) | const |
bool VersionNumber::isPrefixOf | ( | VersionNumber const & | other | ) | const |
Returns true if the current version number is contained in the other version number, otherwise returns false.
int VersionNumber::majorVersion | ( | ) | const |
int VersionNumber::minorVersion | ( | ) | const |
int VersionNumber::microVersion | ( | ) | const |
auto VersionNumber::suffix | ( | ) | const -> std::string |
auto VersionNumber::normalized | ( | ) | const -> VersionNumber |
Returns an equivalent version number but with all trailing zeros removed.
To check if two numbers are equivalent, use normalized() on both version numbers before performing the compare.
int VersionNumber::segmentAt | ( | int | index | ) | const |
int VersionNumber::segmentCount | ( | ) | const |
auto VersionNumber::segments | ( | ) | const -> std::vector<int> const & |
auto VersionNumber::toString | ( | bool | withSuffix = false | ) | const -> std::string |
|
static |
|
staticnoexcept |
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero, depending on whether v1 is less than, equal to, or greater than v2, respectively.
Comparisons are performed by comparing the segments of v1 and v2 starting at index 0 and working towards the end of the longer list.
|
static |