Utilities for creating version info and checks.
More...
|
Utilities for encoding a version from its components.
|
#define | KOS_VERSION_MAKE(major, minor, patch) |
| Creates a version identifier from its constituents.
|
|
#define | KOS_VERSION_MAKE_STRING(major, minor, patch) |
| Creates a version string from its constituents.
|
|
|
Utilities for creating version checks.
|
#define | KOS_VERSION_MAKE_COMPARISON(major, minor, patch, op, version) |
| Creates a generic check against a given version.
|
|
#define | KOS_VERSION_MAKE_ABOVE(major, minor, patch, version) |
| Creates a check for being above a given version.
|
|
#define | KOS_VERSION_MAKE_MIN(major, minor, patch, version) |
| Creates a minimum version check.
|
|
#define | KOS_VERSION_MAKE_IS(major, minor, patch, version) |
| Creates an exact version check.
|
|
#define | KOS_VERSION_MAKE_MAX(major, minor, patch, version) |
| Creates a maximum version check.
|
|
#define | KOS_VERSION_MAKE_BELOW(major, minor, patch, version) |
| Creates a check for being below a given version.
|
|
Utilities for creating version info and checks.
These are generalized utilities for construction of version info at compile-time. They are what KOS uses internally, but they can also be used externally to generate version info and version check utilities for your application.
- Note
- The ranges for the components of a version ID are as follows:
Component | Bits | Range |
Major | 8 | 0-255 |
Minor | 8 | 0-255 |
Patch | 8 | 0-255 |
◆ KOS_VERSION_MAKE
#define KOS_VERSION_MAKE |
( |
| major, |
|
|
| minor, |
|
|
| patch ) |
Value: (((major) << 16) | ((minor) << 8) | (patch))
Creates a version identifier from its constituents.
Used to create a version identifier at compile-time from its components.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
- Returns
- Packed version identifier.
◆ KOS_VERSION_MAKE_ABOVE
#define KOS_VERSION_MAKE_ABOVE |
( |
| major, |
|
|
| minor, |
|
|
| patch, |
|
|
| version ) |
Value:
#define KOS_VERSION_MAKE_COMPARISON(major, minor, patch, op, version)
Creates a generic check against a given version.
Definition version.h:289
Creates a check for being above a given version.
Used to create a compile-time greater-than check against another version.
- Note
- Simply wrap this in a function to implement a runtime check.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
version | The reference version ID. |
- Return values
-
true | The given version is above version . |
false | The given version is at or below version . |
◆ KOS_VERSION_MAKE_BELOW
#define KOS_VERSION_MAKE_BELOW |
( |
| major, |
|
|
| minor, |
|
|
| patch, |
|
|
| version ) |
Value:
Creates a check for being below a given version.
Used to create a compile-time less-than check against another version.
- Note
- Simply wrap this in a function to implement a runtime check.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
version | The reference version ID. |
- Return values
-
true | The given version is below version . |
false | The given version is at or above version . |
◆ KOS_VERSION_MAKE_COMPARISON
#define KOS_VERSION_MAKE_COMPARISON |
( |
| major, |
|
|
| minor, |
|
|
| patch, |
|
|
| op, |
|
|
| version ) |
Value:
#define KOS_VERSION_MAKE(major, minor, patch)
Creates a version identifier from its constituents.
Definition version.h:251
Creates a generic check against a given version.
Bottom-level macro used to create all compile-time comparison checks against other versions.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
op | Integer comparison operator (<= , >= , != , == , etc)/ |
version | Encoded version to compare against. |
- Returns
- Boolean value for the given version compared against
version
using op
.
◆ KOS_VERSION_MAKE_IS
#define KOS_VERSION_MAKE_IS |
( |
| major, |
|
|
| minor, |
|
|
| patch, |
|
|
| version ) |
Value:
Creates an exact version check.
Used to create a compile-time exact version check.
- Note
- Simply wrap this in a function to implement a runtime check.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
version | The exact version ID to match. |
- Return values
-
true | The given version matches version exactly. |
false | The given version does not match version . |
◆ KOS_VERSION_MAKE_MAX
#define KOS_VERSION_MAKE_MAX |
( |
| major, |
|
|
| minor, |
|
|
| patch, |
|
|
| version ) |
Value:
Creates a maximum version check.
Used to create a compile-time maximum version check.
- Note
- Simply wrap this in a function to implement a runtime check.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
version | The maximum version ID. |
- Return values
-
true | The given version is at or below version . |
false | The given version is above version . |
◆ KOS_VERSION_MAKE_MIN
#define KOS_VERSION_MAKE_MIN |
( |
| major, |
|
|
| minor, |
|
|
| patch, |
|
|
| version ) |
Value:
Creates a minimum version check.
Used to create a compile-time minimum version check.
- Note
- Simply wrap this in a function to implement a runtime check.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | Patch version component. |
version | The minimum version ID. |
- Return values
-
true | The given version is at or above version . |
false | The given version is below version . |
◆ KOS_VERSION_MAKE_STRING
#define KOS_VERSION_MAKE_STRING |
( |
| major, |
|
|
| minor, |
|
|
| patch ) |
Value: KOS_STRINGIFY(major) "." \
KOS_STRINGIFY(minor) "." \
KOS_STRINGIFY(patch)
Creates a version string from its constituents.
Used to create a compile-time string literal from version components.
- Parameters
-
major | Major version component. |
minor | Minor version component. |
patch | patch versoin component. |
- Returns
NULL
-terminated C string literal in the format major.minor.patch