VLink  2.0.0
A high-performance communication middleware
vlink::Version Struct Referencefinal

Semantic version number with comparison and string-conversion helpers. More...

#include <types.h>

Collaboration diagram for vlink::Version:

Public Member Functions

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 Public Member Functions

static Version from_string (const std::string &version_str) noexcept
 Parses a version string in "major.minor.patch" form. More...
 

Public Attributes

int major {-1}
 Major version number; -1 when unset. More...
 
int minor {-1}
 Minor version number; -1 when unset. More...
 
int patch {-1}
 Patch version number; -1 when unset. More...
 

Detailed Description

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.

Member Function Documentation

◆ 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_strSource 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
targetVersion to compare against.
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
targetVersion to compare against.
Returns
true when this version is less than target.

◆ operator==()

bool vlink::Version::operator== ( const Version target) const
noexcept

Tests equality with target.

Parameters
targetVersion to compare against.
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
targetVersion to compare against.
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".

Member Data Documentation

◆ 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: