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 8 #ifndef BOOST_PREDEF_VERSION_NUMBER_H 9 #define BOOST_PREDEF_VERSION_NUMBER_H 10 11 /* tag::reference[] 12 = `BOOST_VERSION_NUMBER` 13 14 [source] 15 ---- 16 BOOST_VERSION_NUMBER(major,minor,patch) 17 ---- 18 19 Defines standard version numbers, with these properties: 20 21 * Decimal base whole numbers in the range [0,1000000000). 22 The number range is designed to allow for a (2,2,5) triplet. 23 Which fits within a 32 bit value. 24 * The `major` number can be in the [0,99] range. 25 * The `minor` number can be in the [0,99] range. 26 * The `patch` number can be in the [0,99999] range. 27 * Values can be specified in any base. As the defined value 28 is an constant expression. 29 * Value can be directly used in both preprocessor and compiler 30 expressions for comparison to other similarly defined values. 31 * The implementation enforces the individual ranges for the 32 major, minor, and patch numbers. And values over the ranges 33 are truncated (modulo). 34 35 */ // end::reference[] 36 #define BOOST_VERSION_NUMBER(major,minor,patch) \ 37 ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) ) 38 39 #define BOOST_VERSION_NUMBER_MAX \ 40 BOOST_VERSION_NUMBER(99,99,99999) 41 42 #define BOOST_VERSION_NUMBER_ZERO \ 43 BOOST_VERSION_NUMBER(0,0,0) 44 45 #define BOOST_VERSION_NUMBER_MIN \ 46 BOOST_VERSION_NUMBER(0,0,1) 47 48 #define BOOST_VERSION_NUMBER_AVAILABLE \ 49 BOOST_VERSION_NUMBER_MIN 50 51 #define BOOST_VERSION_NUMBER_NOT_AVAILABLE \ 52 BOOST_VERSION_NUMBER_ZERO 53 54 /* tag::reference[] 55 [source] 56 ---- 57 BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N) 58 ---- 59 60 The macros extract the major, minor, and patch portion from a well formed 61 version number resulting in a preprocessor expression in the range of 62 [0,99] or [0,99999] for the major and minor, or patch numbers 63 respectively. 64 */ // end::reference[] 65 #define BOOST_VERSION_NUMBER_MAJOR(N) \ 66 ( ((N)/10000000)%100 ) 67 68 #define BOOST_VERSION_NUMBER_MINOR(N) \ 69 ( ((N)/100000)%100 ) 70 71 #define BOOST_VERSION_NUMBER_PATCH(N) \ 72 ( (N)%100000 ) 73 74 #endif 75