Semantic version number with comparison and string-conversion helpers.
More...
#include <types.h>
|
| bool | operator== (const Version &target) const noexcept |
| | Tests equality with target. More...
|
| |
| bool | operator!= (const Version &target) const noexcept |
| | Tests inequality with target. More...
|
| |
| bool | operator< (const Version &target) const noexcept |
| | Reports whether this version is strictly older than target. More...
|
| |
| bool | operator> (const Version &target) const noexcept |
| | Reports whether this version is strictly newer than target. More...
|
| |
| std::string | to_string () const noexcept |
| | Serialises this version back to a "major.minor.patch" string. More...
|
| |
| bool | is_valid () const noexcept |
| | Returns whether every component has been set to a non-negative value. More...
|
| |
|
| static Version | from_string (const std::string &version_str) noexcept |
| | Parses a version string in "major.minor.patch" form. More...
|
| |
Semantic version number with comparison and string-conversion helpers.
Used by NodeImpl::check_version() to compare a build-time application version against the live VLink library version. All components default to -1, which marks the value as not yet set.
◆ from_string()
| static Version vlink::Version::from_string |
( |
const std::string & |
version_str | ) |
|
|
staticnoexcept |
Parses a version string in "major.minor.patch" form.
Each component is decoded with std::from_chars; components missing from version_str retain the -1 sentinel.
- Parameters
-
| version_str | Source string such as "2.1.0". |
- Returns
- Parsed
Version.
◆ is_valid()
| bool vlink::Version::is_valid |
( |
| ) |
const |
|
noexcept |
Returns whether every component has been set to a non-negative value.
- Returns
true when the version has been parsed or assigned explicitly.
◆ operator!=()
| bool vlink::Version::operator!= |
( |
const Version & |
target | ) |
const |
|
noexcept |
Tests inequality with target.
- Parameters
-
- Returns
- Logical negation of
operator==.
◆ operator<()
| bool vlink::Version::operator< |
( |
const Version & |
target | ) |
const |
|
noexcept |
Reports whether this version is strictly older than target.
Numeric ordering: compares major first, then minor, then patch.
- Parameters
-
- Returns
true when this version is less than target.
◆ operator==()
| bool vlink::Version::operator== |
( |
const Version & |
target | ) |
const |
|
noexcept |
Tests equality with target.
- Parameters
-
- Returns
true when major, minor and patch all match.
◆ operator>()
| bool vlink::Version::operator> |
( |
const Version & |
target | ) |
const |
|
noexcept |
Reports whether this version is strictly newer than target.
- Parameters
-
- Returns
true when this version is greater than target.
◆ to_string()
| std::string vlink::Version::to_string |
( |
| ) |
const |
|
noexcept |
Serialises this version back to a "major.minor.patch" string.
- Returns
- Formatted version string, e.g.
"2.1.0".
◆ major
| int vlink::Version::major {-1} |
Major version number; -1 when unset.
◆ minor
| int vlink::Version::minor {-1} |
Minor version number; -1 when unset.
◆ patch
| int vlink::Version::patch {-1} |
Patch version number; -1 when unset.
The documentation for this struct was generated from the following file: