C++: add version macro

Fixes #705
This commit is contained in:
Olivier Goffart 2021-12-06 15:36:16 +01:00 committed by GitHub
parent f27a2b8c74
commit 53775465dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 9 deletions

View file

@ -42,6 +42,19 @@ struct ItemVTable;
/// \endrst
namespace sixtyfps {
// these macro are defined in the generated sixtyfps_internal.h
#if defined(DOXYGEN)
/// This macro expands to the to the numeric value of the major version of SixtyFPS you're developing against.
/// For example if you're using version 1.5.2, this macro will expand to 1.
#define SIXTYFPS_VERSION_MAJOR SIXTYFPS_VERSION_MAJOR
/// This macro expands to the to the numeric value of the minor version of SixtyFPS you're developing against.
/// For example if you're using version 1.5.2, this macro will expand to 5.
#define SIXTYFPS_VERSION_MINOR SIXTYFPS_VERSION_MINOR
/// This macro expands to the to the numeric value of the patch version of SixtyFPS you're developing against.
/// For example if you're using version 1.5.2, this macro will expand to 2.
#define SIXTYFPS_VERSION_PATCH SIXTYFPS_VERSION_PATCH
#endif
// Bring opaque structure in scope
namespace private_api {
using cbindgen_private::ComponentVTable;
@ -756,6 +769,12 @@ inline bool operator!=(const StandardListViewItem &a, const StandardListViewItem
}
namespace private_api {
// Code generated by SixtyFPS <= 0.1.5 uses this enum with VersionCheckHelper
enum class [[deprecated]] VersionCheck {
Major = SIXTYFPS_VERSION_MAJOR,
Minor = SIXTYFPS_VERSION_MINOR,
Patch = SIXTYFPS_VERSION_PATCH
};
template<int Major, int Minor, int Patch>
struct VersionCheckHelper
{