ignition/math/SemanticVersion.hh
More...
#include <SemanticVersion.hh>
ignition/math/SemanticVersion.hh
Version comparison class based on Semantic Versioning 2.0.0 http://semver.org/ Compares versions and converts versions from string.
◆ SemanticVersion() [1/4]
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::SemanticVersion |
( |
| ) |
|
Default constructor.
Use the Parse function to populate an instance with version information.
◆ SemanticVersion() [2/4]
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::SemanticVersion |
( |
const std::string & | _v | ) |
|
|
explicit |
Constructor.
- Parameters
-
[in] | _v | the string version. ex: "0.3.2" |
◆ SemanticVersion() [3/4]
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::SemanticVersion |
( |
const SemanticVersion & | _copy | ) |
|
Copy constructor.
- Parameters
-
[in] | _copy | the other version |
◆ SemanticVersion() [4/4]
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::SemanticVersion |
( |
const unsigned int | _major, |
|
|
const unsigned int | _minor = 0, |
|
|
const unsigned int | _patch = 0, |
|
|
const std::string & | _prerelease = "", |
|
|
const std::string & | _build = "" ) |
Constructor.
- Parameters
-
[in] | _major | The major number |
[in] | _minor | The minor number |
[in] | _patch | The patch number |
[in] | _prerelease | The prerelease string |
[in] | _build | The build metadata string |
◆ ~SemanticVersion()
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::~SemanticVersion |
( |
| ) |
|
◆ Build()
std::string ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::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 ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::Major |
( |
| ) |
const |
Get the major number.
- Returns
- The major number
◆ Minor()
unsigned int ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::Minor |
( |
| ) |
const |
Get the minor number.
- Returns
- The minor number
◆ operator!=()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::operator!= |
( |
const SemanticVersion & | _other | ) |
const |
Inequality comparison operator.
- Parameters
-
[in] | _other | The other version to compare to |
- Returns
- True if _other version is different
◆ operator<()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::operator< |
( |
const SemanticVersion & | _other | ) |
const |
Less than comparison operator.
- Parameters
-
[in] | _other | The other version to compare to |
- Returns
- True if _other version is newer
◆ operator<=()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::operator<= |
( |
const SemanticVersion & | _other | ) |
const |
Less than or equal comparison operator.
- Parameters
-
[in] | _other | The other version to compare to |
- Returns
- True if _other version is newer or equal
◆ operator=()
Assignment operator.
- Parameters
-
[in] | _other | The version to assign from. |
- Returns
- The reference to this instance
◆ operator==()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::operator== |
( |
const SemanticVersion & | _other | ) |
const |
Equality comparison operator.
- Parameters
-
[in] | _other | The other version to compare to |
- Returns
- True if _other version is the same
◆ operator>()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::operator> |
( |
const SemanticVersion & | _other | ) |
const |
Greater than comparison operator.
- Parameters
-
[in] | _other | The other version to compare to |
- Returns
- True if _other version is older
◆ operator>=()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::operator>= |
( |
const SemanticVersion & | _other | ) |
const |
Greater than or equal comparison operator.
- Parameters
-
[in] | _other | The other version to compare to |
- Returns
- True if _other version is older or the same
◆ Parse()
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::Parse |
( |
const std::string & | _versionStr | ) |
|
Parse a version string and set the major, minor, patch numbers, and prerelease and build strings.
- Parameters
-
[in] | _versionStr | The version string, such as "1.2.3-pr+123" \retur True on success. |
◆ Patch()
unsigned int ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::Patch |
( |
| ) |
const |
Get the patch number.
- Returns
- The patch number
◆ Prerelease()
std::string ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::Prerelease |
( |
| ) |
const |
Get the prerelease string.
- Returns
- Prelrease string, empty if a prerelease string was not specified.
◆ Version()
std::string ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SemanticVersion::Version |
( |
| ) |
const |
Returns the version as a string.
- Returns
- The semantic version string
The documentation for this class was generated from the following file: