version_number.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. Copyright Rene Rivera 2005-2016
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef BOOST_PREDEF_VERSION_NUMBER_H
  8. #define BOOST_PREDEF_VERSION_NUMBER_H
  9. /*`
  10. [heading `BOOST_VERSION_NUMBER`]
  11. ``
  12. BOOST_VERSION_NUMBER(major,minor,patch)
  13. ``
  14. Defines standard version numbers, with these properties:
  15. * Decimal base whole numbers in the range \[0,1000000000).
  16. The number range is designed to allow for a (2,2,5) triplet.
  17. Which fits within a 32 bit value.
  18. * The `major` number can be in the \[0,99\] range.
  19. * The `minor` number can be in the \[0,99\] range.
  20. * The `patch` number can be in the \[0,99999\] range.
  21. * Values can be specified in any base. As the defined value
  22. is an constant expression.
  23. * Value can be directly used in both preprocessor and compiler
  24. expressions for comparison to other similarly defined values.
  25. * The implementation enforces the individual ranges for the
  26. major, minor, and patch numbers. And values over the ranges
  27. are truncated (modulo).
  28. */
  29. #define BOOST_VERSION_NUMBER(major,minor,patch) \
  30. ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) )
  31. #define BOOST_VERSION_NUMBER_MAX \
  32. BOOST_VERSION_NUMBER(99,99,99999)
  33. #define BOOST_VERSION_NUMBER_ZERO \
  34. BOOST_VERSION_NUMBER(0,0,0)
  35. #define BOOST_VERSION_NUMBER_MIN \
  36. BOOST_VERSION_NUMBER(0,0,1)
  37. #define BOOST_VERSION_NUMBER_AVAILABLE \
  38. BOOST_VERSION_NUMBER_MIN
  39. #define BOOST_VERSION_NUMBER_NOT_AVAILABLE \
  40. BOOST_VERSION_NUMBER_ZERO
  41. /*`
  42. ``
  43. BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N)
  44. ``
  45. The macros extract the major, minor, and patch portion from a well formed
  46. version number resulting in a preprocessor expression in the range of
  47. \[0,99\] or \[0,99999\] for the major and minor, or patch numbers
  48. respectively.
  49. */
  50. #define BOOST_VERSION_NUMBER_MAJOR(N) \
  51. ( ((N)/10000000)%100 )
  52. #define BOOST_VERSION_NUMBER_MINOR(N) \
  53. ( ((N)/100000)%100 )
  54. #define BOOST_VERSION_NUMBER_PATCH(N) \
  55. ( (N)%100000 )
  56. #endif