STFishFinder API  API version 0.0.0, Documentation version 3 -PRELIMINARY-
STFF::Version Class Reference

The Version class provides software version information. More...

Public Member Functions

uint32_t GetMajor () const
 Provides the major version number, e.g., 1 for "1.2.3". More...
 
uint32_t GetMinor () const
 Provides the minor version number, e.g., 2 for "1.2.3". More...
 
uint32_t GetPatch () const
 Provides the patch version number, e.g., 3 for "1.2.3". More...
 
void GetPreReleaseString (char *pPreReleaseString, uint16_t *pLength) const
 Provides the pre-release string component of the version. More...
 
void GetBuildMetadataString (char *pBuildMetadata, uint16_t *pLength) const
 Provides the build metadata component of the version. More...
 
void GetVersionString (char *pVersion, uint16_t *pLength) const
 Provides the full version number as a string, e.g., "1.2.3-prerelease+buildmetadata". More...
 
bool IsAtLeast (const Version *pCompareVersion) const
 Compares a provided version against the actual version. More...
 
bool IsAtLeast (uint32_t major, uint32_t minor, uint32_t patch, const char *pPreRelease=0) const
 Compares a provided version against the actual version. More...
 
 Version (uint32_t major, uint32_t minor, uint32_t patch, const char *preReleaseString, uint32_t preReleaseLength, const char *buildMetadataString, uint32_t buildMetadataLength)
 Constructor for the Version class. More...
 
 Version (const Version &)
 Copy constructor for the Version class.
 
Versionoperator= (const Version &)
 Assignment operator for the Version class.
 
 ~Version ()
 Destructor for the Version class. More...
 

Static Public Attributes

static const uint16_t MaxStringLength = 256
 Maximum size of character strings, including the terminating '\0', provided by certain Version getter member functions. More...
 

Friends

class STFishFinder
 

Detailed Description

The Version class provides software version information.

In the STFishFinder API, instances of the Version class are used to provide version information for the API itself, and for the bootloader and firmware in a connected black box fish finder.

The version data in this class attempts to conform to the Semantic Versioning Specification v2.0.0; see www.semver.org for an explanation of how to interpret the meaning of a version number change.

See also
STFishFinder::GetApiVersion()
STFishFinder::GetFirmwareVersion()
STFishFinder::GetBootloaderVersion()

Definition at line 58 of file STFF-Version.h.

Constructor & Destructor Documentation

STFF::Version::Version ( uint32_t  major,
uint32_t  minor,
uint32_t  patch,
const char *  preReleaseString,
uint32_t  preReleaseLength,
const char *  buildMetadataString,
uint32_t  buildMetadataLength 
)

Constructor for the Version class.

Parameters
[in]majorthe major version number, e.g., 1 for "1.2.3"
[in]minorthe minor version number, e.g., 2 for "1.2.3"
[in]patchthe patch version number, e.g., 3 for "1.2.3"
[in]preReleaseStringpointer to a buffer containing a C-style string representing the pre-release field of the version. If this parameter is null, then the pre-release string is regarded as an empty string.
[in]preReleaseLengthnumber of characters in preReleaseString.
[in]buildMetadataStringpointer to a buffer containing a C-style string representing the build metadata field of the version. If this parameter is null, then the pre-release string is regarded as an empty string.
[in]buildMetadataLengthnumber of characters in buildMetadataString.
Returns
N/A
See also
~Version ()
STFF::Version::~Version ( )

Destructor for the Version class.

See also
Version (uint32_t, uint32_t, uint32_t, const char*, uint32_t, const char*, uint32_t)

Member Function Documentation

STFF::Version::GetBuildMetadataString ( char *  pBuildMetadata,
uint16_t *  pLength 
) const

Provides the build metadata component of the version.

Parameters
[out]pBuildMetadataPointer to buffer into which this function will store a null-terminated C-style string containing the build metadata component of the version. The number of characters written, including the terminating '\0', will never exceed the value of Version::MaxStringLength. If the pBuildMetadata parameter is a null pointer, then nothing will be written to the buffer.
[out]pLengthPointer to location into which this function will store the number of characters in the string. The value stored does not account for the terminating '\0'. If this parameter is a null pointer, then no value will be stored.
Returns
void
Note
The returned string does not include the ("+") prefix to the build metadata string.
See also
MaxStringLength
STFF::Version::GetMajor ( ) const

Provides the major version number, e.g., 1 for "1.2.3".

Returns
the major version number
STFF::Version::GetMinor ( ) const

Provides the minor version number, e.g., 2 for "1.2.3".

Returns
the minor version number
STFF::Version::GetPatch ( ) const

Provides the patch version number, e.g., 3 for "1.2.3".

Returns
the patch version number
STFF::Version::GetPreReleaseString ( char *  pPreReleaseString,
uint16_t *  pLength 
) const

Provides the pre-release string component of the version.

Parameters
[out]pPreReleaseStringPointer to buffer into which this function will store a null-terminated C-style string containing the pre-release component of the version. The number of characters written, including the terminating '\0', will never exceed the value of Version::MaxStringLength. If this parameter is a null pointer, then nothing will be written to the buffer.
[out]pLengthPointer to location into which this function will store the number of characters in the string. The value stored does not account for the terminating '\0'. If this parameter is a null pointer, then no value will be stored.
Returns
void
Note
The provided string does not include the hyphen ("-") prefix to the pre-release string.
See also
MaxStringLength
STFF::Version::GetVersionString ( char *  pVersion,
uint16_t *  pLength 
) const

Provides the full version number as a string, e.g., "1.2.3-prerelease+buildmetadata".

Parameters
[out]pVersionPointer to buffer into which this function will store a null-terminated C-style string containing the entire version string. The number of characters written, including the terminating '\0', will never exceed the value of Version::MaxStringLength. If the pVersion parameter is a null pointer, then nothing will be written to the buffer.
[out]pLengthPointer to location into which this function will store the number of characters in the string. The value stored does not account for the terminating '\0'. If this parameter is a null pointer, then no value will be stored.
Returns
void
See also
MaxStringLength
STFF::Version::IsAtLeast ( const Version pCompareVersion) const

Compares a provided version against the actual version.

Returns true if the actual version is greater than or equal to the provided version.

Parameters
[in]pCompareVersionpointer to Version object containing the version to be compared against
Return values
trueif the current API version >= *pCompareVersion.
falseotherwise
Note
The precedence rules for the comparison operation follow the conventions of Semantic Versioning v2.0.0, described at www.semver.org.
The build metadata field is not considered when comparing precedence between versions.
STFF::Version::IsAtLeast ( uint32_t  major,
uint32_t  minor,
uint32_t  patch,
const char *  pPreRelease = 0 
) const

Compares a provided version against the actual version.

Returns true if the actual version is greater than or equal to the provided version.

Parameters
[in]majorthe major version number to be compared, e.g., 1 for "1.2.3"
[in]minorthe minor version number to be compared, e.g., 2 for "1.2.3"
[in]patchthe patch version number to be compared, e.g., 3 for "1.2.3"
[in]pPreReleasepointer to a buffer containing a null-terminated C-style string representing the pre-release version field to be compared. If this parameter is null, then the pre-release string is regarded as an empty string.
Return values
trueif the current API version >= (major.minor.patch-prerelease_version).
falseotherwise
Note
The precedence rules for the comparison operation follow the conventions of Semantic Versioning v2.0.0, described at www.semver.org.
The build metadata field is not considered when comparing precedence between versions.

Member Data Documentation

STFF::Version::MaxStringLength = 256
static

Maximum size of character strings, including the terminating '\0', provided by certain Version getter member functions.

In the unlikely event a string were to exceed this length, it will be truncated to this length by the getter function before storing to the caller's buffer.

Definition at line 70 of file STFF-Version.h.


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