Gazebo Math

API Reference

8.1.0
SemanticVersion Class Reference

Version comparison class based on Semantic Versioning 2.0.0 http://semver.org/ Compares versions and converts versions from string. More...

#include <SemanticVersion.hh>

Public Member Functions

 SemanticVersion ()
 Default constructor. Use the Parse function to populate an instance with version information.
 
 SemanticVersion (const std::string &_v)
 Constructor.
 
 SemanticVersion (const unsigned int _major, const unsigned int _minor=0, const unsigned int _patch=0, const std::string &_prerelease="", const std::string &_build="")
 Constructor.
 
std::string Build () const
 Get the build metadata string. Build meta data is not used when determining precedence.
 
unsigned int Major () const
 Get the major number.
 
unsigned int Minor () const
 Get the minor number.
 
bool operator!= (const SemanticVersion &_other) const
 Inequality comparison operator.
 
bool operator< (const SemanticVersion &_other) const
 Less than comparison operator.
 
bool operator<= (const SemanticVersion &_other) const
 Less than or equal comparison operator.
 
bool operator== (const SemanticVersion &_other) const
 Equality comparison operator.
 
bool operator> (const SemanticVersion &_other) const
 Greater than comparison operator.
 
bool operator>= (const SemanticVersion &_other) const
 Greater than or equal comparison operator.
 
bool Parse (const std::string &_versionStr)
 Parse a version string and set the major, minor, patch numbers, and prerelease and build strings.
 
unsigned int Patch () const
 Get the patch number.
 
std::string Prerelease () const
 Get the prerelease string.
 
std::string Version () const
 Returns the version as a string.
 

Detailed Description

Version comparison class based on Semantic Versioning 2.0.0 http://semver.org/ Compares versions and converts versions from string.

gz/math/SemanticVersion.hh

Constructor & Destructor Documentation

◆ SemanticVersion() [1/3]

Default constructor. Use the Parse function to populate an instance with version information.

◆ SemanticVersion() [2/3]

SemanticVersion ( const std::string _v)
explicit

Constructor.

Parameters
[in]_vthe string version. ex: "0.3.2"

◆ SemanticVersion() [3/3]

SemanticVersion ( const unsigned int  _major,
const unsigned int  _minor = 0,
const unsigned int  _patch = 0,
const std::string _prerelease = "",
const std::string _build = "" 
)
explicit

Constructor.

Parameters
[in]_majorThe major number
[in]_minorThe minor number
[in]_patchThe patch number
[in]_prereleaseThe prerelease string
[in]_buildThe build metadata string

Member Function Documentation

◆ Build()

std::string Build ( ) const

Get the build metadata string. Build meta data is not used when determining precedence.

Returns
Build metadata string, empty if a build metadata string was not specified.

◆ Major()

unsigned int Major ( ) const

Get the major number.

Returns
The major number

◆ Minor()

unsigned int Minor ( ) const

Get the minor number.

Returns
The minor number

◆ operator!=()

bool operator!= ( const SemanticVersion _other) const

Inequality comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is different

◆ operator<()

bool operator< ( const SemanticVersion _other) const

Less than comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is newer

◆ operator<=()

bool operator<= ( const SemanticVersion _other) const

Less than or equal comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is newer or equal

◆ operator==()

bool operator== ( const SemanticVersion _other) const

Equality comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is the same

◆ operator>()

bool operator> ( const SemanticVersion _other) const

Greater than comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is older

◆ operator>=()

bool operator>= ( const SemanticVersion _other) const

Greater than or equal comparison operator.

Parameters
[in]_otherThe other version to compare to
Returns
True if _other version is older or the same

◆ Parse()

bool Parse ( const std::string _versionStr)

Parse a version string and set the major, minor, patch numbers, and prerelease and build strings.

Parameters
[in]_versionStrThe version string, such as "1.2.3-pr+123"
Returns
True on success.

◆ Patch()

unsigned int Patch ( ) const

Get the patch number.

Returns
The patch number

◆ Prerelease()

std::string Prerelease ( ) const

Get the prerelease string.

Returns
Prelrease string, empty if a prerelease string was not specified.

◆ Version()

std::string Version ( ) const

Returns the version as a string.

Returns
The semantic version string

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