Semantic version number with comparison and string conversion utilities.
更多...
#include <types.h>
|
| bool | operator== (const Version &target) const noexcept |
| | Returns true when both versions are identical.
|
| bool | operator!= (const Version &target) const noexcept |
| | Returns true when versions differ.
|
| bool | operator< (const Version &target) const noexcept |
| | Returns true when this version is older than target.
|
| bool | operator> (const Version &target) const noexcept |
| | Returns true when this version is newer than target.
|
| std::string | to_string () const noexcept |
| | Converts this version to a "major.minor.patch" string.
|
| bool | is_valid () const noexcept |
| | Returns true when all three components are non-negative.
|
|
| static Version | from_string (const std::string &version_str) noexcept |
| | Parses a version string in "major.minor.patch" format.
|
|
| int | major {-1} |
| | Major version number; -1 if not set.
|
| int | minor {-1} |
| | Minor version number; -1 if not set.
|
| int | patch {-1} |
| | Patch version number; -1 if not set.
|
Semantic version number with comparison and string conversion utilities.
Used by NodeImpl::check_version() to compare the compile-time VLink version against the runtime library version. All fields default to -1 (invalid).
◆ from_string()
| Version vlink::Version::from_string |
( |
const std::string & | version_str | ) |
|
|
staticnodiscardnoexcept |
Parses a version string in "major.minor.patch" format.
Uses std::from_chars for each component; components missing from the string remain -1.
- 参数
-
| version_str | String such as "2.1.0". |
- 返回
- Parsed
Version; any missing component stays -1.
◆ is_valid()
| bool vlink::Version::is_valid |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns true when all three components are non-negative.
- 返回
true if the version was successfully parsed or explicitly set.
◆ operator!=()
| bool vlink::Version::operator!= |
( |
const Version & | target | ) |
const |
|
nodiscardnoexcept |
Returns true when versions differ.
- 参数
-
- 返回
- Logical negation of
operator==.
◆ operator<()
| bool vlink::Version::operator< |
( |
const Version & | target | ) |
const |
|
nodiscardnoexcept |
Returns true when this version is older than target.
Compares major first, then minor, then patch (numeric order).
- 参数
-
- 返回
true if this version is strictly less than target.
◆ operator==()
| bool vlink::Version::operator== |
( |
const Version & | target | ) |
const |
|
nodiscardnoexcept |
Returns true when both versions are identical.
- 参数
-
- 返回
true if major, minor, and patch are all equal.
◆ operator>()
| bool vlink::Version::operator> |
( |
const Version & | target | ) |
const |
|
nodiscardnoexcept |
Returns true when this version is newer than target.
- 参数
-
- 返回
true if this version is strictly greater than target.
◆ to_string()
| std::string vlink::Version::to_string |
( |
| ) |
const |
|
nodiscardnoexcept |
Converts this version to a "major.minor.patch" string.
- 返回
- Formatted version string, e.g.
"2.1.0".
◆ major
| int vlink::Version::major {-1} |
Major version number; -1 if not set.
◆ minor
| int vlink::Version::minor {-1} |
Minor version number; -1 if not set.
◆ patch
| int vlink::Version::patch {-1} |
Patch version number; -1 if not set.
该结构体的文档由以下文件生成: