version.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*!
  2. @file
  3. Defines macros for tracking the version of the library.
  4. @copyright Louis Dionne 2013-2017
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_VERSION_HPP
  9. #define BOOST_HANA_VERSION_HPP
  10. //! @internal
  11. //! Transforms a (version, revision, patchlevel) triple into a number of the
  12. //! form 0xVVRRPPPP to allow comparing versions in a normalized way.
  13. //!
  14. //! See http://sourceforge.net/p/predef/wiki/VersionNormalization.
  15. #define BOOST_HANA_CONFIG_VERSION(version, revision, patch) \
  16. (((version) << 24) + ((revision) << 16) + (patch))
  17. //! @ingroup group-config
  18. //! Macro expanding to the major version of the library, i.e. the `x` in `x.y.z`.
  19. #define BOOST_HANA_MAJOR_VERSION 1
  20. //! @ingroup group-config
  21. //! Macro expanding to the minor version of the library, i.e. the `y` in `x.y.z`.
  22. #define BOOST_HANA_MINOR_VERSION 6
  23. //! @ingroup group-config
  24. //! Macro expanding to the patch level of the library, i.e. the `z` in `x.y.z`.
  25. #define BOOST_HANA_PATCH_VERSION 0
  26. //! @ingroup group-config
  27. //! Macro expanding to the full version of the library, in hexadecimal
  28. //! representation.
  29. //!
  30. //! Specifically, `BOOST_HANA_VERSION` expands to an hexadecimal number of the
  31. //! form 0xVVRRPPPP, where `VV` is the major version of the library, `RR` is
  32. //! the minor version and `PPPP` is the patch level. This allows the version
  33. //! of the library to be compared:
  34. //! @snippet example/version.cpp main
  35. //!
  36. //!
  37. //! @note
  38. //! The major, minor and patch versions of the library are also available
  39. //! individually with the `BOOST_HANA_{MAJOR,MINOR,PATCH}_VERSION` macros.
  40. #define BOOST_HANA_VERSION \
  41. BOOST_HANA_CONFIG_VERSION(BOOST_HANA_MAJOR_VERSION, \
  42. BOOST_HANA_MINOR_VERSION, \
  43. BOOST_HANA_PATCH_VERSION) \
  44. /**/
  45. #endif // !BOOST_HANA_VERSION_HPP