40 pVersionInfo->
rev = 0;
52 pVersionInfo->
major = (encodedVersion >> 24) & 0xFF;
53 pVersionInfo->
minor = (encodedVersion >> 16) & 0xFF;
54 pVersionInfo->
rev = (encodedVersion >> 8) & 0xFF;
55 pVersionInfo->
build = (encodedVersion >> 0) & 0xFF;
71 uint32_t encodedVersion = 0;
86 assert((pVersionInfo->
major <= 63) && (pVersionInfo->
minor <= 63) && (pVersionInfo->
rev == 0));
98 assert(pVersionInfo->
major <= 127);
106 return encodedVersion;
130 assert((pVersionA) && (pVersionB));
173 result = pVersionA->
rev - pVersionB->
rev;
256 assert(pLowerVersion);
257 assert(pHigherVersion);
282 assert(lowerVersion <= higherVersion);
291 if (version < lowerVersion)
295 else if (version > higherVersion)
324 assert((pVersionInfo) && (pBuffer) && (sizeOfBuffer>0));
335 if (sizeOfBuffer >= 19)
340 sprintf(pBuffer,
"%u.%u.%u-", pVersionInfo->
major, pVersionInfo->
minor, pVersionInfo->
build);
348 strcat(pBuffer,
"dev");
351 strcat(pBuffer,
"alpha");
354 strcat(pBuffer,
"beta");
357 strcat(pBuffer,
"rc");
360 strcat(pBuffer,
"stable");
363 strcat(pBuffer,
"hotfix");
384 if (sizeOfBuffer >= 16)
389 sprintf(pBuffer,
"%u.%u.%u.%u", pVersionInfo->
major, pVersionInfo->
minor, pVersionInfo->
rev, pVersionInfo->
build);
442 char qualifierStr[32];
451 assert((pVersionStr) && (pVersionInfo));
456 memset(pVersionInfo, 0x00,
sizeof(
SbgVersion));
461 if (sscanf(pVersionStr,
"%u.%u.%u.%u", &major, &minor, &rev, &build) == 4)
471 pVersionInfo->
major = (uint8_t)major;
472 pVersionInfo->
minor = (uint8_t)minor;
473 pVersionInfo->
rev = (uint8_t)rev;
474 pVersionInfo->
build = (uint8_t)build;
476 else if (sscanf(pVersionStr,
"%u.%u.%u-%s", &major, &minor, &build, qualifierStr) == 4)
486 pVersionInfo->
major = (uint8_t)major;
487 pVersionInfo->
minor = (uint8_t)minor;
488 pVersionInfo->
build = (uint16_t)build;
493 if (!strcmp(qualifierStr,
"dev"))
500 else if (!strcmp(qualifierStr,
"alpha"))
507 else if (!strcmp(qualifierStr,
"beta"))
514 else if (!strcmp(qualifierStr,
"rc"))
521 else if (!strcmp(qualifierStr,
"stable"))
528 else if (!strcmp(qualifierStr,
"hotfix"))
568 assert((pVersionStr) && (pVersion));
SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromStringEncoded(const char *pVersionStr, uint32_t *pVersion)
Helper methods and definitions used to handle version.
SBG_COMMON_LIB_API SbgErrorCode sbgVersionToStringEncoded(uint32_t version, char *pBuffer, uint32_t sizeOfBuffer)
#define SBG_COMMON_LIB_API
#define SBG_VERSION_SOFT_SCHEME_QUALIFIER_MASK
#define SBG_VERSION_SOFT_SCHEME_BUILD_SHIFT
SBG_INLINE bool sbgVersionIsUsingSoftwareScheme(uint32_t encodedVersion)
#define SBG_VERSION_SOFT_SCHEME_MINOR_SHIFT
SBG_COMMON_LIB_API SbgErrorCode sbgVersionFromString(const char *pVersionStr, SbgVersion *pVersionInfo)
enum _SbgVersionCmpThresold SbgVersionCmpThresold
#define SBG_VERSION_SOFT_SCHEME_MINOR_MASK
SBG_COMMON_LIB_API int32_t sbgVersionCompareEncoded(uint32_t versionA, uint32_t versionB, SbgVersionCmpThresold thresold)
SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRange(const SbgVersion *pLowerVersion, const SbgVersion *pHigherVersion, const SbgVersion *pVersion)
SBG_COMMON_LIB_API int32_t sbgVersionCompare(const SbgVersion *pVersionA, const SbgVersion *pVersionB, SbgVersionCmpThresold thresold)
SBG_COMMON_LIB_API SbgErrorCode sbgVersionToString(const SbgVersion *pVersionInfo, char *pBuffer, uint32_t sizeOfBuffer)
#define SBG_VERSION_SOFT_SCHEME_MAJOR_SHIFT
enum _SbgVersionQualifier SbgVersionQualifier
#define SBG_VERSION_SOFT_SCHEME
SBG_COMMON_LIB_API uint32_t sbgVersionEncode(const SbgVersion *pVersionInfo)
SBG_COMMON_LIB_API int32_t sbgVersionIsWithinRangeEncoded(uint32_t lowerVersion, uint32_t higherVersion, uint32_t version)
#define SBG_VERSION_SOFTWARE(major, minor, build, qualifier)
#define SBG_VERSION_SOFT_SCHEME_BUILD_MASK
enum _SbgErrorCode SbgErrorCode
#define SBG_VERSION_BASIC(major, minor, rev, build)
#define SBG_VERSION_SOFT_SCHEME_MAJOR_MASK
SbgVersionQualifier qualifier
SBG_COMMON_LIB_API void sbgVersionDecode(uint32_t encodedVersion, SbgVersion *pVersionInfo)
#define SBG_VERSION_SOFT_SCHEME_QUALIFIER_SHIFT