Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Functions
Version

Description

Numeric version handling.

Helpers to convert version strings to numbers and vice versa. Version numbers of type uint32_t can be compared arbitrarily in order to check if some tool is newer or older than some reference.

Collaboration diagram for Version:

Functions

static uint32_t VersionCompose (uint8_t major, uint8_t minor, uint16_t revision, bool dirty=false)
 
static int VersionMajor (uint32_t ver)
 Get the major component of the version.
 
static int VersionMinor (uint32_t ver)
 Get the minor component of the version.
 
static int VersionRevision (uint32_t ver)
 Get the revision component of the version.
 
static bool VersionDirty (uint32_t ver)
 Get the "dirty" component of the version.
 
uint32_t VersionFromStr (const char *str)
 Get a numeric representation of the version string. On syntax error, a warning is logged and 0 is returned.
 
const char * VersionToStr (class CString *ret, uint32_t ver)
 Get a string representation of the version. This may be shorter than an eventual original string passed to VersionFromStr(), i.e. an eventual git ID is missing.
 
static const char * VersionGetOwnAsStr ()
 Get my own build version as a string.
 
uint32_t VersionGetOwn ()
 Get my own build version.
 

Function Documentation

◆ VersionCompose()

static uint32_t VersionCompose ( uint8_t  major,
uint8_t  minor,
uint16_t  revision,
bool  dirty = false 
)
inlinestatic

<Compose a numeric representation of the version.

Parameters
majoris the major version component.
minoris the minor version component.
revisionis the revision version component.
dirtyis a flag indicating whether the code has been modified locally compared to the version.

Definition at line 377 of file base.H.