jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau::util::VersionNumber Class Reference

Simple version number class containing a version number either being defined explicit or derived from a string. More...

#include <VersionNumber.hpp>

Inheritance diagram for jau::util::VersionNumber:
Collaboration diagram for jau::util::VersionNumber:

Public Member Functions

constexpr VersionNumber () noexcept
 Default ctor for zero version.
 
constexpr VersionNumber (const VersionNumber &) noexcept=default
 
constexpr VersionNumber (int majorRev, int minorRev, int subMinorRev) noexcept
 Explicit version number instantiation, with all components defined explicitly excluding git.
 
constexpr VersionNumber (int majorRev, int minorRev, int subMinorRev, int gitCommits, uint64_t gitSSHA, bool gitDirty) noexcept
 Explicit version number instantiation, with all components defined explicitly including git.
 
constexpr VersionNumber (VersionNumber &&) noexcept=default
 
constexpr int git_commits () const noexcept
 
constexpr bool git_dirty () const noexcept
 
constexpr uint64_t git_ssha () const noexcept
 
constexpr bool hasGitInfo () const noexcept
 Returns true, if the optional git information is defined explicitly, otherwise false.
 
constexpr std::size_t hash () const noexcept
 
constexpr bool hasMajor () const noexcept
 Returns true, if the major component is defined explicitly, otherwise false.
 
constexpr bool hasMinor () const noexcept
 Returns true, if the optional minor component is defined explicitly, otherwise false.
 
constexpr bool hasSub () const noexcept
 Returns true, if the optional sub component is defined explicitly, otherwise false.
 
constexpr bool isZero () const noexcept
 Returns true, if all version components are zero, otherwise false.
 
constexpr int major () const noexcept
 
constexpr int minor () const noexcept
 
constexpr std::strong_ordering operator<=> (const VersionNumber &vo) const noexcept
 Three way std::strong_ordering comparison operator.
 
constexpr VersionNumberoperator= (const VersionNumber &) noexcept=default
 
constexpr VersionNumberoperator= (VersionNumber &&) noexcept=default
 
constexpr bool operator== (const VersionNumber &vo) const noexcept
 Two way comparison operator.
 
constexpr int sub () const noexcept
 
std::string toString () const noexcept
 

Protected Member Functions

constexpr VersionNumber (int majorRev, int minorRev, int subMinorRev, int gitCommits, uint64_t gitSSHA, bool gitDirty, uint16_t _state) noexcept
 

Protected Attributes

int m_git_commits
 
bool m_git_dirty
 
uint64_t m_git_ssha
 
int m_major
 
int m_minor
 
uint16_t m_state
 
int m_sub
 

Static Protected Attributes

static constexpr const bool DBG_OUT = false
 
static constexpr const uint16_t HAS_GIT_INFO = 1U << 3
 
static constexpr const uint16_t HAS_MAJOR = 1U << 0
 
static constexpr const uint16_t HAS_MINOR = 1U << 1
 
static constexpr const uint16_t HAS_SUB = 1U << 2
 

Detailed Description

Simple version number class containing a version number either being defined explicit or derived from a string.

For the latter case, you can query whether a component has been defined explicitly by the given versionString, via hasMajor(), hasMinor() and hasSub().

The state whether a component is defined explicitly is not considered in the hashCode(), equals(Object) or compareTo(Object) methods, since the version number itself is treated regardless.

Definition at line 52 of file VersionNumber.hpp.

Constructor & Destructor Documentation

◆ VersionNumber() [1/6]

jau::util::VersionNumber::VersionNumber ( int majorRev,
int minorRev,
int subMinorRev,
int gitCommits,
uint64_t gitSSHA,
bool gitDirty,
uint16_t _state )
inlineconstexprprotectednoexcept

Definition at line 68 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ VersionNumber() [2/6]

jau::util::VersionNumber::VersionNumber ( int majorRev,
int minorRev,
int subMinorRev,
int gitCommits,
uint64_t gitSSHA,
bool gitDirty )
inlineconstexprnoexcept

Explicit version number instantiation, with all components defined explicitly including git.

See also
hasMajor()
hasMinor()
hasSub()
hasGitInfo()

Definition at line 83 of file VersionNumber.hpp.

◆ VersionNumber() [3/6]

jau::util::VersionNumber::VersionNumber ( int majorRev,
int minorRev,
int subMinorRev )
inlineconstexprnoexcept

Explicit version number instantiation, with all components defined explicitly excluding git.

See also
hasMajor()
hasMinor()
hasSub()

Definition at line 95 of file VersionNumber.hpp.

◆ VersionNumber() [4/6]

jau::util::VersionNumber::VersionNumber ( )
inlineconstexprnoexcept

Default ctor for zero version.

See also
hasMajor()
hasMinor()
hasSub()

Definition at line 105 of file VersionNumber.hpp.

◆ VersionNumber() [5/6]

jau::util::VersionNumber::VersionNumber ( const VersionNumber & )
constexprdefaultnoexcept

◆ VersionNumber() [6/6]

jau::util::VersionNumber::VersionNumber ( VersionNumber && )
constexprdefaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

VersionNumber & jau::util::VersionNumber::operator= ( const VersionNumber & )
constexprdefaultnoexcept

◆ operator=() [2/2]

VersionNumber & jau::util::VersionNumber::operator= ( VersionNumber && )
constexprdefaultnoexcept

◆ isZero()

bool jau::util::VersionNumber::isZero ( ) const
inlineconstexprnoexcept

Returns true, if all version components are zero, otherwise false.

Definition at line 115 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ hasMajor()

bool jau::util::VersionNumber::hasMajor ( ) const
inlineconstexprnoexcept

Returns true, if the major component is defined explicitly, otherwise false.

Undefined components has the value 0.

Definition at line 120 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ hasMinor()

bool jau::util::VersionNumber::hasMinor ( ) const
inlineconstexprnoexcept

Returns true, if the optional minor component is defined explicitly, otherwise false.

Undefined components has the value 0.

Definition at line 122 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ hasSub()

bool jau::util::VersionNumber::hasSub ( ) const
inlineconstexprnoexcept

Returns true, if the optional sub component is defined explicitly, otherwise false.

Undefined components has the value 0.

Definition at line 124 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ hasGitInfo()

bool jau::util::VersionNumber::hasGitInfo ( ) const
inlineconstexprnoexcept

Returns true, if the optional git information is defined explicitly, otherwise false.

Definition at line 126 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ major()

int jau::util::VersionNumber::major ( ) const
inlineconstexprnoexcept

Definition at line 128 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ minor()

int jau::util::VersionNumber::minor ( ) const
inlineconstexprnoexcept

Definition at line 129 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ sub()

int jau::util::VersionNumber::sub ( ) const
inlineconstexprnoexcept

Definition at line 130 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ git_commits()

int jau::util::VersionNumber::git_commits ( ) const
inlineconstexprnoexcept

Definition at line 131 of file VersionNumber.hpp.

◆ git_ssha()

uint64_t jau::util::VersionNumber::git_ssha ( ) const
inlineconstexprnoexcept

Definition at line 132 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ git_dirty()

bool jau::util::VersionNumber::git_dirty ( ) const
inlineconstexprnoexcept

Definition at line 133 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ operator==()

bool jau::util::VersionNumber::operator== ( const VersionNumber & vo) const
inlineconstexprnoexcept

Two way comparison operator.

Definition at line 136 of file VersionNumber.hpp.

◆ operator<=>()

std::strong_ordering jau::util::VersionNumber::operator<=> ( const VersionNumber & vo) const
inlineconstexprnoexcept

Three way std::strong_ordering comparison operator.

Definition at line 142 of file VersionNumber.hpp.

◆ hash()

std::size_t jau::util::VersionNumber::hash ( ) const
inlineconstexprnoexcept

Definition at line 174 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ toString()

std::string jau::util::VersionNumber::toString ( ) const
inlinenoexcept

Definition at line 183 of file VersionNumber.hpp.

Member Data Documentation

◆ m_major

int jau::util::VersionNumber::m_major
protected

Definition at line 54 of file VersionNumber.hpp.

◆ m_minor

int jau::util::VersionNumber::m_minor
protected

Definition at line 54 of file VersionNumber.hpp.

◆ m_sub

int jau::util::VersionNumber::m_sub
protected

Definition at line 54 of file VersionNumber.hpp.

◆ m_git_commits

int jau::util::VersionNumber::m_git_commits
protected

Definition at line 55 of file VersionNumber.hpp.

◆ m_git_ssha

uint64_t jau::util::VersionNumber::m_git_ssha
protected

Definition at line 56 of file VersionNumber.hpp.

◆ m_git_dirty

bool jau::util::VersionNumber::m_git_dirty
protected

Definition at line 57 of file VersionNumber.hpp.

◆ m_state

uint16_t jau::util::VersionNumber::m_state
protected

Definition at line 59 of file VersionNumber.hpp.

◆ DBG_OUT

const bool jau::util::VersionNumber::DBG_OUT = false
staticconstexprprotected

Definition at line 61 of file VersionNumber.hpp.

◆ HAS_MAJOR

const uint16_t jau::util::VersionNumber::HAS_MAJOR = 1U << 0
staticconstexprprotected

Definition at line 63 of file VersionNumber.hpp.

◆ HAS_MINOR

const uint16_t jau::util::VersionNumber::HAS_MINOR = 1U << 1
staticconstexprprotected

Definition at line 64 of file VersionNumber.hpp.

◆ HAS_SUB

const uint16_t jau::util::VersionNumber::HAS_SUB = 1U << 2
staticconstexprprotected

Definition at line 65 of file VersionNumber.hpp.

◆ HAS_GIT_INFO

const uint16_t jau::util::VersionNumber::HAS_GIT_INFO = 1U << 3
staticconstexprprotected

Definition at line 66 of file VersionNumber.hpp.


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