omw  0.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
omw::Version Class Reference

Compliant to semver. More...

Public Member Functions

 Version ()
 
 Version (int32_t major, int32_t minor, int32_t patch, const char *preRelease, const char *build=nullptr)
 
 Version (int32_t major, int32_t minor, int32_t patch, const std::string &preRelease="", const std::string &build="")
 
 Version (const char *str)
 
 Version (const std::string &str)
 
void set (int32_t major, int32_t minor, int32_t patch, const char *preRelease, const char *build=nullptr)
 
void set (int32_t major, int32_t minor, int32_t patch, const std::string &preRelease="", const std::string &build="")
 
void set (const char *str)
 
void set (const std::string &str)
 
int32_t major () const
 
int32_t minor () const
 
int32_t patch () const
 
omw::string preRelease () const
 
const omw::stringVector_t & preReleaseIdentifiers () const
 
omw::string build () const
 
const omw::stringVector_t & buildIdentifiers () const
 
int compare (const omw::Version &b) const
 
omw::string toString () const
 
bool hasBuild () const
 
bool isPreRelease () const
 
bool isValid () const
 

Protected Member Functions

void parse (const omw::string &str)
 
void parseBuild (const omw::string &identifiers)
 
void parsePreRelease (const omw::string &identifiers)
 
void parseVersion (const omw::string &identifiers)
 

Protected Attributes

int32_t m_maj
 
int32_t m_min
 
int32_t m_pat
 
omw::stringVector_t m_preRelease
 
omw::stringVector_t m_build
 

Detailed Description

Compliant to semver.

#include <omw/version.h>

Compliant to Semantic Versioning 2.0.0.

Constructor & Destructor Documentation

◆ Version()

omw::Version::Version ( )

Creates an object with version 0.0.0.

Member Function Documentation

◆ compare()

int omw::Version::compare ( const omw::Version b) const

Compares according to the semver rules.

Result Return Value
*this < b <0
*this == b 0
*this > b >0

◆ hasBuild()

bool omw::Version::hasBuild ( ) const

Returns true if the version has build identifiers, otherwise false.

◆ isPreRelease()

bool omw::Version::isPreRelease ( ) const

Returns true if the version has pre-release identifiers, otherwise false.

◆ isValid()

bool omw::Version::isValid ( ) const

Checks if the member values are compliant to semver. See omw::Version.


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