DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::updating::SemanticVersion Class Reference

Represents a semantic version with major, minor, patch. Additionally, supports the inclusion of optional pre-release, and build metadata components. It adheres to the Semantic Versioning 2.0.0 standard. More...

#include <Version.hpp>

Collaboration diagram for drn::updating::SemanticVersion:

Public Member Functions

 SemanticVersion ()
 Default constructor that initializes version to 0.0.0 with any pre-release nor build metadata.
 
 SemanticVersion (const ::QString &version)
 Full initialisation string constructor following the semantic version format.
 
 SemanticVersion (std::uint8_t major, std::uint8_t minor, std::uint8_t patch, std::optional<::QString > preRelease=std::nullopt, std::optional<::QString > buildMetadata=std::nullopt)
 Full initialisation constructor.
 
const std::optional<::QString > & buildMetadata () const noexcept
 An accessor to the build metadata.
 
std::uint8_t major () const noexcept
 An accessor to the major version.
 
std::uint8_t minor () const noexcept
 An accessor to the minor version.
 
bool operator!= (const SemanticVersion &other) const noexcept=default
 
std::strong_ordering operator<=> (const SemanticVersion &other) const noexcept
 Compares two objects using a three-way comparison.
 
bool operator== (const SemanticVersion &other) const noexcept
 
std::uint8_t patch () const noexcept
 An accessor to the patch version.
 
const std::optional<::QString > & preRelease () const noexcept
 An accessor to the pre-release version.
 

Friends

DRN_UPDATING_EXPORT std::ostream & operator<< (std::ostream &out, const SemanticVersion &sv)
 Populates an output stream with a semantic version.
 

Detailed Description

Represents a semantic version with major, minor, patch. Additionally, supports the inclusion of optional pre-release, and build metadata components. It adheres to the Semantic Versioning 2.0.0 standard.

See also
https://semver.org/ for more information.

Constructor & Destructor Documentation

◆ SemanticVersion() [1/3]

drn::updating::SemanticVersion::SemanticVersion ( )

Default constructor that initializes version to 0.0.0 with any pre-release nor build metadata.

Here is the caller graph for this function:

◆ SemanticVersion() [2/3]

drn::updating::SemanticVersion::SemanticVersion ( std::uint8_t major,
std::uint8_t minor,
std::uint8_t patch,
std::optional<::QString > preRelease = std::nullopt,
std::optional<::QString > buildMetadata = std::nullopt )

Full initialisation constructor.

Exceptions
ErrorWhen the pre-release string is invalid.
ErrorWhen the build metadata string is invalid.
Parameters
majorThe major component of the version.
minorThe minor component of the version.
patchThe patch component of the version.
preReleaseAny pre-release identifier for the version.
buildMetadataAny build metadata information.
Here is the call graph for this function:

◆ SemanticVersion() [3/3]

drn::updating::SemanticVersion::SemanticVersion ( const ::QString & version)
explicit

Full initialisation string constructor following the semantic version format.

Exceptions
ErrorWhen the version string is invalid.
Parameters
versionThe semantic version string, e.g. "1.2.3-alpha.1+20241019".

Member Function Documentation

◆ buildMetadata()

const std::optional<::QString > & drn::updating::SemanticVersion::buildMetadata ( ) const
nodiscardnoexcept

An accessor to the build metadata.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ major()

std::uint8_t drn::updating::SemanticVersion::major ( ) const
nodiscardnoexcept

An accessor to the major version.

Here is the caller graph for this function:

◆ minor()

std::uint8_t drn::updating::SemanticVersion::minor ( ) const
nodiscardnoexcept

An accessor to the minor version.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool drn::updating::SemanticVersion::operator!= ( const SemanticVersion & other) const
nodiscarddefaultnoexcept
Here is the call graph for this function:

◆ operator<=>()

std::strong_ordering drn::updating::SemanticVersion::operator<=> ( const SemanticVersion & other) const
nodiscardnoexcept

Compares two objects using a three-way comparison.

The comparison follows semantic versioning rules:

  • If the major versions are different, the one with the higher major version is greater.
  • If the major versions are identical, the minor versions are compared next.
  • If the minor versions are identical, the patch versions are compared next.
  • If the patch versions are identical, pre-release versions are compared next.
  • Pre-release versions have lower precedence than the associated normal version.
  • Build metadata is not considered at any point.
Parameters
otherThe other object to compare with.
Returns
The result of the comparison of this object to the supplied object.
Here is the call graph for this function:

◆ operator==()

bool drn::updating::SemanticVersion::operator== ( const SemanticVersion & other) const
nodiscardnoexcept
Here is the call graph for this function:

◆ patch()

std::uint8_t drn::updating::SemanticVersion::patch ( ) const
nodiscardnoexcept

An accessor to the patch version.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ preRelease()

const std::optional<::QString > & drn::updating::SemanticVersion::preRelease ( ) const
nodiscardnoexcept

An accessor to the pre-release version.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

DRN_UPDATING_EXPORT std::ostream & operator<< ( std::ostream & out,
const SemanticVersion & sv )
friend

Populates an output stream with a semantic version.

Parameters
outThe output stream to populate.
svThe version object to fill the stream with.
Postcondition
The output stream contains the version in the form:
  • major.minor.patch-preRelease+buildMetadata
Returns
The output stream with the version.