Lunchbox  1.8.0
version.h
1 
2 /* Copyright (c) 2011-2012, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef LUNCHBOX_VERSION_H
19 #define LUNCHBOX_VERSION_H
20 
21 #include <lunchbox/api.h>
22 #include <lunchbox/types.h>
23 #include <string>
24 
25 namespace lunchbox
26 {
27  // LunchBox version macros and functions
29 # define LUNCHBOX_VERSION_MAJOR 1
30 
32 # define LUNCHBOX_VERSION_MINOR 8
33 
35 # define LUNCHBOX_VERSION_PATCH 0
36 
38 # define LUNCHBOX_VERSION_ABI 2
39 
41 # define LUNCHBOX_VERSION_GT( MAJOR, MINOR, PATCH ) \
42  ( (LUNCHBOX_VERSION_MAJOR>MAJOR) || \
43  (LUNCHBOX_VERSION_MAJOR==MAJOR && \
44  (LUNCHBOX_VERSION_MINOR>MINOR || \
45  (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH>PATCH))))
46 
48 # define LUNCHBOX_VERSION_GE( MAJOR, MINOR, PATCH ) \
49  ( (LUNCHBOX_VERSION_MAJOR>MAJOR) || \
50  (LUNCHBOX_VERSION_MAJOR==MAJOR && \
51  (LUNCHBOX_VERSION_MINOR>MINOR || \
52  (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH>=PATCH))))
53 
55 # define LUNCHBOX_VERSION_LT( MAJOR, MINOR, PATCH ) \
56  ( (LUNCHBOX_VERSION_MAJOR<MAJOR) || \
57  (LUNCHBOX_VERSION_MAJOR==MAJOR && \
58  (LUNCHBOX_VERSION_MINOR<MINOR || \
59  (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH<PATCH))))
60 
62 # define LUNCHBOX_VERSION_LE( MAJOR, MINOR, PATCH ) \
63  ( (LUNCHBOX_VERSION_MAJOR<MAJOR) || \
64  (LUNCHBOX_VERSION_MAJOR==MAJOR && \
65  (LUNCHBOX_VERSION_MINOR<MINOR || \
66  (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH<=PATCH))))
67 
69  class LUNCHBOX_API Version
70  {
71  public:
73  static uint32_t getMajor();
74 
76  static uint32_t getMinor();
77 
79  static uint32_t getPatch();
80 
82  static std::string getRevision();
83 
85  static uint32_t getABI();
86 
88  static uint32_t getInt();
89 
91  static float getFloat();
92 
97  static std::string getString();
98 
103  static bool check()
104  { return getMajor()==LUNCHBOX_VERSION_MAJOR && getMinor()==LUNCHBOX_VERSION_MINOR; }
105  };
106 }
107 
108 #endif //LUNCHBOX_VERSION_H