libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gbl::Version Class Reference

Public Member Functions

constexpr Version (uint8_t major=0, uint16_t minor=0, uint8_t patch=0) noexcept
 
constexpr Version (GblVersion version) noexcept
 
 Version (const char *pString)
 
constexpr uint8_t major () const noexcept
 
constexpr uint16_t minor () const noexcept
 
constexpr uint8_t patch () const noexcept
 
constexpr void setMajor (uint8_t major) noexcept
 
constexpr void setMinor (uint16_t minor) noexcept
 
constexpr void setPatch (uint16_t patch) noexcept
 
constexpr operator GblVersion () const noexcept
 

Detailed Description

Definition at line 8 of file gimbal_version.hpp.

Constructor & Destructor Documentation

◆ Version() [1/3]

constexpr gbl::Version::Version ( uint8_t  major = 0,
uint16_t  minor = 0,
uint8_t  patch = 0 
)
inlineconstexprnoexcept

Definition at line 13 of file gimbal_version.hpp.

15 :
16 version_(GBL_VERSION_MAKE_(major, minor, patch)) {}

◆ Version() [2/3]

constexpr gbl::Version::Version ( GblVersion  version)
inlineconstexprnoexcept

Definition at line 18 of file gimbal_version.hpp.

18 :
19 version_(version) {}

◆ Version() [3/3]

gbl::Version::Version ( const char *  pString)
inline

Definition at line 21 of file gimbal_version.hpp.

21 {
22 // check for errors, throw exception
23 version_ = GblVersion_parse(pString);
24 }
GblVersion GblVersion_parse(const char *pString)
Parses and returns a GblVersion from an encoded version string in the format "MAJOR....

Member Function Documentation

◆ major()

constexpr uint8_t gbl::Version::major ( ) const
inlineconstexprnoexcept

Definition at line 26 of file gimbal_version.hpp.

26{ return (version_ >> GBL_VERSION_MAJOR_BITPOS) & GBL_VERSION_MAJOR_MASK; }
#define GBL_VERSION_MAJOR_BITPOS
Bit position of the MAJOR field.
#define GBL_VERSION_MAJOR_MASK
Bit mask of the MAJOR field.

◆ minor()

constexpr uint16_t gbl::Version::minor ( ) const
inlineconstexprnoexcept

Definition at line 27 of file gimbal_version.hpp.

27{ return (version_ >> GBL_VERSION_MINOR_BITPOS) & GBL_VERSION_MINOR_MASK; }
#define GBL_VERSION_MINOR_BITPOS
Bit position of the MINOR field.
#define GBL_VERSION_MINOR_MASK
Bit mask of the MINOR field.

◆ patch()

constexpr uint8_t gbl::Version::patch ( ) const
inlineconstexprnoexcept

Definition at line 28 of file gimbal_version.hpp.

28{ return (version_ >> GBL_VERSION_PATCH_BITPOS) & GBL_VERSION_PATCH_MASK; }
#define GBL_VERSION_PATCH_MASK
Bit mask of the PATCH field.
#define GBL_VERSION_PATCH_BITPOS
Bit position of the PATCH field.

◆ setMajor()

constexpr void gbl::Version::setMajor ( uint8_t  major)
inlineconstexprnoexcept

Definition at line 30 of file gimbal_version.hpp.

30 {
32 version_ |= (major << GBL_VERSION_MAJOR_BITPOS);
33 }

◆ setMinor()

constexpr void gbl::Version::setMinor ( uint16_t  minor)
inlineconstexprnoexcept

Definition at line 35 of file gimbal_version.hpp.

35 {
37 version_ |= (minor << GBL_VERSION_MINOR_BITPOS);
38 }

◆ setPatch()

constexpr void gbl::Version::setPatch ( uint16_t  patch)
inlineconstexprnoexcept

Definition at line 40 of file gimbal_version.hpp.

40 {
42 version_ |= (patch << GBL_VERSION_PATCH_BITPOS);
43 }

◆ operator GblVersion()

constexpr gbl::Version::operator GblVersion ( ) const
inlineconstexprnoexcept

Definition at line 45 of file gimbal_version.hpp.

45{ return version_; }

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