jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau::util::VersionNumberString 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::VersionNumberString:
Collaboration diagram for jau::util::VersionNumberString:

Public Member Functions

constexpr VersionNumberString () noexcept
 Default ctor for zero version.
 
 VersionNumberString (const std::string &versionString) noexcept
 String derived version number instantiation.
 
 VersionNumberString (const std::string &versionString, const std::regex &versionPattern) noexcept
 String derived version number instantiation.
 
 VersionNumberString (const std::string &versionString, const std::string &delim) noexcept
 String derived version number instantiation.
 
 VersionNumberString (const VersionNumberString &) noexcept=default
 
 VersionNumberString (VersionNumberString &&) noexcept=default
 
constexpr ssize_t endOfStringMatch () const noexcept
 If constructed with version-string, returns the string offset after the last matching character, or 0 if none matched, or -1 if not constructed with a string.
 
constexpr bool hasString () const noexcept
 Returns true if constructed with a version-string, otherwise false.
 
VersionNumberStringoperator= (const VersionNumberString &) noexcept=default
 
VersionNumberStringoperator= (VersionNumberString &&) noexcept=default
 
std::string toString () const noexcept
 
constexpr const std::string & versionString () const noexcept
 Returns the used version-string, empty if not constructed with such.
 
- Public Member Functions inherited from jau::util::VersionNumber
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
 

Static Public Member Functions

static const std::regex & getDefaultPattern () noexcept
 
static std::regex getPattern (const std::string &delim)
 

Protected Member Functions

constexpr VersionNumberString (int majorRev, int minorRev, int subMinorRev, int gitCommits, uint64_t gitSSHA, bool gitDirty, uint16_t _state, ssize_t strEnd, std::string _version_str) noexcept
 
- Protected Member Functions inherited from jau::util::VersionNumber
constexpr VersionNumber (int majorRev, int minorRev, int subMinorRev, int gitCommits, uint64_t gitSSHA, bool gitDirty, uint16_t _state) noexcept
 

Additional Inherited Members

- Protected Attributes inherited from jau::util::VersionNumber
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 inherited from jau::util::VersionNumber
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 217 of file VersionNumber.hpp.

Constructor & Destructor Documentation

◆ VersionNumberString() [1/7]

jau::util::VersionNumberString::VersionNumberString ( int majorRev,
int minorRev,
int subMinorRev,
int gitCommits,
uint64_t gitSSHA,
bool gitDirty,
uint16_t _state,
ssize_t strEnd,
std::string _version_str )
inlineconstexprprotectednoexcept

Definition at line 223 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ VersionNumberString() [2/7]

jau::util::VersionNumberString::VersionNumberString ( )
inlineconstexprnoexcept

Default ctor for zero version.

See also
hasMajor()
hasMinor()
hasSub()

Definition at line 247 of file VersionNumber.hpp.

◆ VersionNumberString() [3/7]

jau::util::VersionNumberString::VersionNumberString ( const VersionNumberString & )
defaultnoexcept

◆ VersionNumberString() [4/7]

jau::util::VersionNumberString::VersionNumberString ( VersionNumberString && )
defaultnoexcept

◆ VersionNumberString() [5/7]

jau::util::VersionNumberString::VersionNumberString ( const std::string & versionString,
const std::regex & versionPattern )
inlinenoexcept

String derived version number instantiation.

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

Parameters
versionStringshould be given as [MAJOR[.MINOR[.SUB]]]
versionPatternthe pattern parser, must be compatible w/ getVersionNumberPattern(String)
See also
hasMajor()
hasMinor()
hasSub()

Definition at line 269 of file VersionNumber.hpp.

◆ VersionNumberString() [6/7]

jau::util::VersionNumberString::VersionNumberString ( const std::string & versionString)
inlinenoexcept

String derived version number instantiation.

Utilizing the default pattern parser with delimiter "<b>.</b>", see getDefaultVersionNumberPattern().

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

Parameters
versionStringshould be given as [MAJOR[.MINOR[.SUB]]]
See also
hasMajor()
hasMinor()
hasSub()

Definition at line 339 of file VersionNumber.hpp.

◆ VersionNumberString() [7/7]

jau::util::VersionNumberString::VersionNumberString ( const std::string & versionString,
const std::string & delim )
inlinenoexcept

String derived version number instantiation.

Utilizing pattern parser created via getVersionNumberPattern(String).

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

Parameters
versionStringshould be given as [MAJOR[.MINOR[.SUB]]]
delimthe delimiter, e.g. "."
See also
hasMajor()
hasMinor()
hasSub()

Definition at line 359 of file VersionNumber.hpp.

Member Function Documentation

◆ getPattern()

static std::regex jau::util::VersionNumberString::getPattern ( const std::string & delim)
inlinestatic

Definition at line 230 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ getDefaultPattern()

static const std::regex & jau::util::VersionNumberString::getDefaultPattern ( )
inlinestaticnoexcept

Definition at line 236 of file VersionNumber.hpp.

◆ operator=() [1/2]

VersionNumberString & jau::util::VersionNumberString::operator= ( const VersionNumberString & )
defaultnoexcept

◆ operator=() [2/2]

VersionNumberString & jau::util::VersionNumberString::operator= ( VersionNumberString && )
defaultnoexcept

◆ hasString()

bool jau::util::VersionNumberString::hasString ( ) const
inlineconstexprnoexcept

Returns true if constructed with a version-string, otherwise false.

Definition at line 365 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ versionString()

const std::string & jau::util::VersionNumberString::versionString ( ) const
inlineconstexprnoexcept

Returns the used version-string, empty if not constructed with such.

Definition at line 367 of file VersionNumber.hpp.

Here is the caller graph for this function:

◆ endOfStringMatch()

ssize_t jau::util::VersionNumberString::endOfStringMatch ( ) const
inlineconstexprnoexcept

If constructed with version-string, returns the string offset after the last matching character, or 0 if none matched, or -1 if not constructed with a string.

Definition at line 373 of file VersionNumber.hpp.

◆ toString()

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

Definition at line 375 of file VersionNumber.hpp.


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