IDS peak genericC++ v1.17.0
Loading...
Searching...
No Matches
peak::common::Version Class Reference

Represents a structured version identifier following Semantic Versioning 2.0 (major.minor.patch). More...

#include <peak_common/types/peak_common_version.hpp>

Public Member Functions

 Version (uint32_t major, uint32_t minor, uint32_t subminor, uint32_t patch)
 Constructs a Version object with legacy 4-digit layout.
 Version (uint32_t major, uint32_t minor, uint32_t patch)
PEAK_COMMON_NO_DISCARD uint32_t GetMajor () const
 Retrieves the major version component.
PEAK_COMMON_NO_DISCARD uint32_t GetMinor () const
 Retrieves the minor version component.
 PEAK_COMMON_DEPRECATED_MSG ("Deprecated due to SemVer 2.0 migration. Always 0; use GetPatch() instead.") PEAK_COMMON_NO_DISCARD uint32_t GetSubminor() const
PEAK_COMMON_NO_DISCARD uint32_t GetPatch () const
 Retrieves the patch version component.
PEAK_COMMON_NO_DISCARD bool operator== (const Version &other) const
 Checks if two versions are equal.
PEAK_COMMON_NO_DISCARD bool operator!= (const Version &other) const
 Checks if two versions are not equal.
PEAK_COMMON_NO_DISCARD bool operator< (const Version &other) const
 Checks if this version is less than another version.
PEAK_COMMON_NO_DISCARD bool operator> (const Version &other) const
 Checks if this version is greater than another version.
PEAK_COMMON_NO_DISCARD std::string ToString () const
 Converts the version to its string representation (e.g., "1.2.3").

Friends

std::ostream & operator<< (std::ostream &os, Version version)
 Outputs the version in dot-separated string format (e.g., "1.2.3").

Detailed Description

Represents a structured version identifier following Semantic Versioning 2.0 (major.minor.patch).

This class provides utilities for comparing versions and converting them to string format.

Since
ids_peak_common 1.0

Constructor & Destructor Documentation

◆ Version() [1/2]

peak::common::Version::Version ( uint32_t major,
uint32_t minor,
uint32_t subminor,
uint32_t patch )
inline

Constructs a Version object with legacy 4-digit layout.

Deprecated
Deprecated due to SemVer 2.0 migration. Use Version(major, minor, patch) instead.

◆ Version() [2/2]

peak::common::Version::Version ( uint32_t major,
uint32_t minor,
uint32_t patch )
inline
Since
ids_peak_common 2.1

Member Function Documentation

◆ GetMajor()

uint32_t peak::common::Version::GetMajor ( ) const
inline

Retrieves the major version component.

Returns
The major version number.
Since
ids_peak_common 1.0

◆ GetMinor()

uint32_t peak::common::Version::GetMinor ( ) const
inline

Retrieves the minor version component.

Returns
The minor version number.
Since
ids_peak_common 1.0

◆ GetPatch()

uint32_t peak::common::Version::GetPatch ( ) const
inline

Retrieves the patch version component.

Returns
The patch version number.
Since
ids_peak_common 1.0

◆ operator!=()

PEAK_COMMON_NO_DISCARD bool peak::common::Version::operator!= ( const Version & other) const
inline

Checks if two versions are not equal.

Parameters
otherThe version to compare with.
Returns
True if any of the components are not equal; false otherwise.
Since
ids_peak_common 1.0

◆ operator<()

PEAK_COMMON_NO_DISCARD bool peak::common::Version::operator< ( const Version & other) const
inline

Checks if this version is less than another version.

Comparison is performed lexicographically based on version components.

Parameters
otherThe version to compare with.
Returns
True if this version is less than other; false otherwise.
Since
ids_peak_common 1.0

◆ operator==()

PEAK_COMMON_NO_DISCARD bool peak::common::Version::operator== ( const Version & other) const
inline

Checks if two versions are equal.

Parameters
otherThe version to compare with.
Returns
True if all components are equal; false otherwise.
Since
ids_peak_common 1.0

◆ operator>()

PEAK_COMMON_NO_DISCARD bool peak::common::Version::operator> ( const Version & other) const
inline

Checks if this version is greater than another version.

Parameters
otherThe version to compare with.
Returns
True if this version is greater than other; false otherwise.
Since
ids_peak_common 1.0

◆ PEAK_COMMON_DEPRECATED_MSG()

peak::common::Version::PEAK_COMMON_DEPRECATED_MSG ( "Deprecated due to SemVer 2.0 migration. Always 0; use GetPatch() instead." ) const
Deprecated
Deprecated due to SemVer 2.0 migration. Always returns 0; use GetPatch() instead.

◆ ToString()

PEAK_COMMON_NO_DISCARD std::string peak::common::Version::ToString ( ) const
inline

Converts the version to its string representation (e.g., "1.2.3").

Returns
A string containing the formatted version.
Since
ids_peak_common 1.0

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
Version version )
friend

Outputs the version in dot-separated string format (e.g., "1.2.3").

Parameters
osOutput stream.
versionThe version to write.
Returns
Reference to the output stream.
Since
ids_peak_common 1.0

The documentation for this class was generated from the following file: