vsdk 7.3.2
 
Loading...
Searching...
No Matches
Vsdk::Utils::VersionNumber

#include <VersionNumber.hpp>

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.
 
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.
 
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.
 
static auto fromString (std::string const &str) -> VersionNumber
 

Constructor & Destructor Documentation

◆ VersionNumber() [1/8]

Vsdk::Utils::VersionNumber::VersionNumber ( )
defaultnoexcept

◆ VersionNumber() [2/8]

VersionNumber::VersionNumber ( int  major,
std::string const &  suffix = "" 
)

◆ VersionNumber() [3/8]

VersionNumber::VersionNumber ( int  major,
int  minor,
std::string const &  suffix = "" 
)

◆ VersionNumber() [4/8]

VersionNumber::VersionNumber ( int  major,
int  minor,
int  micro,
std::string const &  suffix = "" 
)

◆ VersionNumber() [5/8]

VersionNumber::VersionNumber ( std::initializer_list< int >  args,
std::string const &  suffix = "" 
)

◆ VersionNumber() [6/8]

VersionNumber::VersionNumber ( std::vector< int >  segments,
std::string const &  suffix = "" 
)
explicit

◆ VersionNumber() [7/8]

VersionNumber::VersionNumber ( std::string const &  str)

◆ VersionNumber() [8/8]

VersionNumber::VersionNumber ( const char *  str)

Member Function Documentation

◆ isNormalized()

bool VersionNumber::isNormalized ( ) const

◆ isNull()

bool VersionNumber::isNull ( ) const

◆ isPrefixOf()

bool VersionNumber::isPrefixOf ( VersionNumber const &  other) const

Returns true if the current version number is contained in the other version number, otherwise returns false.

◆ majorVersion()

int VersionNumber::majorVersion ( ) const

◆ minorVersion()

int VersionNumber::minorVersion ( ) const

◆ microVersion()

int VersionNumber::microVersion ( ) const

◆ suffix()

auto VersionNumber::suffix ( ) const -> std::string

◆ normalized()

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.

◆ segmentAt()

int VersionNumber::segmentAt ( int  index) const

◆ segmentCount()

int VersionNumber::segmentCount ( ) const

◆ segments()

auto VersionNumber::segments ( ) const -> std::vector<int> const &

◆ toString()

auto VersionNumber::toString ( bool  withSuffix = false) const -> std::string

◆ commonPrefix()

auto VersionNumber::commonPrefix ( VersionNumber const &  v1,
VersionNumber const &  v2 
) -> VersionNumber
static

◆ compare()

int VersionNumber::compare ( VersionNumber const &  v1,
VersionNumber const &  v2 
)
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.

◆ fromString()

auto VersionNumber::fromString ( std::string const &  str) -> VersionNumber
static