Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Mantid::DataObjects::SemanticVersion Class Reference

Implementation of a SemVer parser. More...

#include <SemanticVersion.h>

Public Member Functions

const std::string & getBuild () const
 
std::uint32_t getMajor () const
 
std::uint32_t getMinor () const
 
std::uint32_t getPatch () const
 
const std::string & getPrerelease () const
 
const std::string & getVersion () const
 
std::strong_ordering operator<=> (const SemanticVersion &other) const
 Comparison operator.
 
std::strong_ordering operator<=> (const std::string &versionStr) const
 Comparison operator.
 
SemanticVersion & operator= (const SemanticVersion &other)=default
 
bool operator== (const SemanticVersion &other) const
 Check if two versions are equivalent.
 
 SemanticVersion ()=delete
 
 SemanticVersion (const SemanticVersion &other)=default
 
 SemanticVersion (const std::string &)
 Constructor using a full version string.
 
 SemanticVersion (std::uint32_t major, std::uint32_t minor=0, std::uint32_t patch=0, const std::string &prerelease="", const std::string &build="")
 Constructor using the full version string from the indidual major, minor, patch, etc.
 
 ~SemanticVersion ()=default
 

Static Public Attributes

static std::regex version_regex
 

Private Member Functions

void parse_version (const std::string &)
 Check and split the version string into major, minor, patch, etc.
 

Private Attributes

std::string m_build = ""
 
std::uint32_t m_major = 0
 
std::uint32_t m_minor = 0
 
std::uint32_t m_patch = 0
 
std::string m_prerelease = ""
 
std::string m_version = ""
 

Detailed Description

Implementation of a SemVer parser.

It supports th following formats :

The implementation is not strict in the sense that:

so e.g.:

Definition at line 41 of file SemanticVersion.h.

Constructor & Destructor Documentation

◆ SemanticVersion() [1/4]

Mantid::DataObjects::SemanticVersion::SemanticVersion ( )
delete

Referenced by operator<=>().

◆ SemanticVersion() [2/4]

Mantid::DataObjects::SemanticVersion::SemanticVersion ( const SemanticVersion &  other)
default

◆ SemanticVersion() [3/4]

Mantid::DataObjects::SemanticVersion::SemanticVersion ( const std::string &  version)

Constructor using a full version string.

The version string is parsed and separated into major, minor, patch, etc.

Parameters
versionThe full version string
Exceptions
std::runtime_errorif parsing fails

Definition at line 45 of file SemanticVersion.cpp.

References parse_version().

◆ SemanticVersion() [4/4]

Mantid::DataObjects::SemanticVersion::SemanticVersion ( std::uint32_t  major,
std::uint32_t  minor = 0,
std::uint32_t  patch = 0,
const std::string &  prerelease = "",
const std::string &  build = "" 
)

Constructor using the full version string from the indidual major, minor, patch, etc.

values

Parameters
majorMajor number of the release
minorMinor number of the release
patchpatch number
prereleasepre-release string
buildbuild id string

Definition at line 55 of file SemanticVersion.cpp.

References m_build, m_prerelease, and m_version.

◆ ~SemanticVersion()

Mantid::DataObjects::SemanticVersion::~SemanticVersion ( )
default

Member Function Documentation

◆ getBuild()

const std::string & Mantid::DataObjects::SemanticVersion::getBuild ( ) const

Definition at line 106 of file SemanticVersion.cpp.

References m_build.

◆ getMajor()

std::uint32_t Mantid::DataObjects::SemanticVersion::getMajor ( ) const

Definition at line 108 of file SemanticVersion.cpp.

References m_major.

◆ getMinor()

std::uint32_t Mantid::DataObjects::SemanticVersion::getMinor ( ) const

Definition at line 110 of file SemanticVersion.cpp.

References m_minor.

◆ getPatch()

std::uint32_t Mantid::DataObjects::SemanticVersion::getPatch ( ) const

Definition at line 112 of file SemanticVersion.cpp.

References m_patch.

◆ getPrerelease()

const std::string & Mantid::DataObjects::SemanticVersion::getPrerelease ( ) const

Definition at line 114 of file SemanticVersion.cpp.

References m_prerelease.

◆ getVersion()

const std::string & Mantid::DataObjects::SemanticVersion::getVersion ( ) const

Definition at line 116 of file SemanticVersion.cpp.

References m_version.

◆ operator<=>() [1/2]

std::strong_ordering Mantid::DataObjects::SemanticVersion::operator<=> ( const SemanticVersion &  other) const

Comparison operator.

the build string is not considered

Parameters
otherOther SemanticVersion class

Definition at line 82 of file SemanticVersion.cpp.

◆ operator<=>() [2/2]

std::strong_ordering Mantid::DataObjects::SemanticVersion::operator<=> ( const std::string &  otherVersionStr) const

Comparison operator.

the build string is not considered

Parameters
otherVersionStrother version string

Definition at line 102 of file SemanticVersion.cpp.

References SemanticVersion().

◆ operator=()

SemanticVersion & Mantid::DataObjects::SemanticVersion::operator= ( const SemanticVersion &  other)
default

◆ operator==()

bool Mantid::DataObjects::SemanticVersion::operator== ( const SemanticVersion &  other) const

Check if two versions are equivalent.

the build string is not considered

Definition at line 71 of file SemanticVersion.cpp.

References m_major, m_minor, m_patch, and m_prerelease.

◆ parse_version()

void Mantid::DataObjects::SemanticVersion::parse_version ( const std::string &  version)
private

Check and split the version string into major, minor, patch, etc.

Parameters
versionfull version string

Definition at line 122 of file SemanticVersion.cpp.

References Mantid::Geometry::m, m_build, m_major, m_minor, m_patch, m_prerelease, value, and version_regex.

Referenced by SemanticVersion().

Member Data Documentation

◆ m_build

std::string Mantid::DataObjects::SemanticVersion::m_build = ""
private

Definition at line 111 of file SemanticVersion.h.

Referenced by getBuild(), parse_version(), and SemanticVersion().

◆ m_major

std::uint32_t Mantid::DataObjects::SemanticVersion::m_major = 0
private

Definition at line 99 of file SemanticVersion.h.

Referenced by getMajor(), operator==(), and parse_version().

◆ m_minor

std::uint32_t Mantid::DataObjects::SemanticVersion::m_minor = 0
private

Definition at line 102 of file SemanticVersion.h.

Referenced by getMinor(), operator==(), and parse_version().

◆ m_patch

std::uint32_t Mantid::DataObjects::SemanticVersion::m_patch = 0
private

Definition at line 105 of file SemanticVersion.h.

Referenced by getPatch(), operator==(), and parse_version().

◆ m_prerelease

std::string Mantid::DataObjects::SemanticVersion::m_prerelease = ""
private

Definition at line 108 of file SemanticVersion.h.

Referenced by getPrerelease(), operator==(), parse_version(), and SemanticVersion().

◆ m_version

std::string Mantid::DataObjects::SemanticVersion::m_version = ""
private

Definition at line 96 of file SemanticVersion.h.

Referenced by getVersion(), and SemanticVersion().

◆ version_regex

std::regex Mantid::DataObjects::SemanticVersion::version_regex
static

Definition at line 45 of file SemanticVersion.h.

Referenced by parse_version().


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