Back to home page

EIC code displayed by LXR

 
 

    


Warning, /algorithms/core/version.h.in is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 Wouter Deconinck
0003 //
0004 // Version of the algorithms library, generated by CMake from core/version.h.in
0005 //
0006 // Use the preprocessor macros for conditional compilation, e.g.
0007 //
0008 //   #include <algorithms/version.h>
0009 //   #if ALGORITHMS_VERSION >= ALGORITHMS_VERSION_CODE(2, 1, 0)
0010 //   ...
0011 //   #endif
0012 //
0013 // and the constexpr variables and function in all other cases.
0014 //
0015 #pragma once
0016 
0017 #include <string_view>
0018 
0019 #define ALGORITHMS_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
0020 #define ALGORITHMS_VERSION_MINOR @PROJECT_VERSION_MINOR@
0021 #define ALGORITHMS_VERSION_PATCH @PROJECT_VERSION_PATCH@
0022 #define ALGORITHMS_VERSION_STRING "@PROJECT_VERSION@"
0023 
0024 // Encode a version as a single integer, ordered like the version (minor and
0025 // patch must be below 1000)
0026 #define ALGORITHMS_VERSION_CODE(major, minor, patch)                                               \
0027   ((major) * 1000000 + (minor) * 1000 + (patch))
0028 #define ALGORITHMS_VERSION                                                                         \
0029   ALGORITHMS_VERSION_CODE(ALGORITHMS_VERSION_MAJOR, ALGORITHMS_VERSION_MINOR,                      \
0030                           ALGORITHMS_VERSION_PATCH)
0031 
0032 namespace algorithms {
0033 
0034 inline constexpr unsigned int versionMajor     = ALGORITHMS_VERSION_MAJOR;
0035 inline constexpr unsigned int versionMinor     = ALGORITHMS_VERSION_MINOR;
0036 inline constexpr unsigned int versionPatch     = ALGORITHMS_VERSION_PATCH;
0037 inline constexpr std::string_view versionString = ALGORITHMS_VERSION_STRING;
0038 
0039 // True if this version is at least major.minor.patch
0040 constexpr bool versionAtLeast(unsigned int major, unsigned int minor = 0, unsigned int patch = 0) {
0041   if (versionMajor != major) {
0042     return versionMajor > major;
0043   }
0044   if (versionMinor != minor) {
0045     return versionMinor > minor;
0046   }
0047   return versionPatch >= patch;
0048 }
0049 
0050 } // namespace algorithms