HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_Version.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_Version.h ( UT Library, C/C++)
7  */
8 
9 /*
10  * NOTE: This is automatically generated from SYS_Version.tmpl.h
11  */
12 #ifndef __SYS_Version__
13 #define __SYS_Version__
14 
15 /// @file SYS_Version.h
16 /// Defines compile time version constants for use in code.
17 /// @note Please see UT_String::compareVersionString()
18 
19 // <sys/types.h> defines macros with the names 'major' and 'minor'.
20 // glibc 2.25+ emits deprecation warnings for this, so eventually the include
21 // of <sys/sysmacros.h> will be removed and the undef'ing won't be necessary.
22 #undef major
23 #undef minor
24 
25 
26 // The major.minor.build version as a string
27 #define SYS_VERSION_FULL "17.0.376"
28 
29 // The major.minor version as a string
30 #define SYS_VERSION_RELEASE "17.0"
31 
32 // The major version. .9 counts as next higher.
33 #define SYS_VERSION_MAJOR "17"
34 #define SYS_VERSION_MINOR "0"
35 #define SYS_VERSION_BUILD "376"
36 #define SYS_VERSION_PATCH "0"
37 
38 // Version numbers as integer values
39 #define SYS_VERSION_MAJOR_INT 17
40 #define SYS_VERSION_MINOR_INT 0
41 #define SYS_VERSION_BUILD_INT 376
42 #define SYS_VERSION_PATCH_INT 0
43 
44 // Version as a packed integer: ("%02x%02x%04x", major, minor, build)
45 #define SYS_VERSION_FULL_INT 0x11000178
46 
47 #if defined(__cplusplus)
48 struct SYS_Version
49 {
50  /// Return the "major.minor.build" version
51  static inline const char *full() { return SYS_VERSION_FULL; }
52 
53  /// Return the "major.minor" version
54  static inline const char *release() { return SYS_VERSION_RELEASE; }
55 
56  /// Return the "major" version
57  static inline const char *major() { return SYS_VERSION_MAJOR; }
58 
59  /// Return the "minor" version
60  static inline const char *minor() { return SYS_VERSION_MINOR; }
61 
62  /// Return the "build" version
63  static inline const char *build() { return SYS_VERSION_BUILD; }
64 
65  /// Return the "patch" version
66  static inline const char *patch() { return SYS_VERSION_PATCH; }
67 
68  /// Return the full version as a numerical set of values.
69  static inline void getFull(int &major, int &minor, int &build,
70  int *patch = 0)
71  {
72  major = SYS_VERSION_MAJOR_INT;
73  minor = SYS_VERSION_MINOR_INT;
74  build = SYS_VERSION_BUILD_INT;
75  if (patch)
76  *patch = SYS_VERSION_PATCH_INT;
77  }
78 
79  /// Return the release version as a numerical set of values.
80  static inline void getRelease(int &major, int &minor)
81  {
82  major = SYS_VERSION_MAJOR_INT;
83  minor = SYS_VERSION_MINOR_INT;
84  }
85 
86  static inline int compare(int major1, int minor1, int build1,
87  int major2, int minor2, int build2)
88  {
89  if(major1 != major2) return major1 - major2;
90  if(minor1 != minor2) return minor1 - minor2;
91  if(build1 != build2) return build1 - build2;
92  return 0;
93  }
94 
95  static inline int compare(int major1, int minor1, int build1, int patch1,
96  int major2, int minor2, int build2, int patch2)
97  {
98  if(major1 != major2) return major1 - major2;
99  if(minor1 != minor2) return minor1 - minor2;
100  if(build1 != build2) return build1 - build2;
101  if(patch1 != patch2) return patch1 - patch2;
102  return 0;
103  }
104 };
105 #endif
106 
107 #endif
108 
#define SYS_VERSION_MINOR_INT
Definition: SYS_Version.h:40
#define SYS_VERSION_BUILD
Definition: SYS_Version.h:35
#define SYS_VERSION_MAJOR_INT
Definition: SYS_Version.h:39
#define SYS_VERSION_RELEASE
Definition: SYS_Version.h:30
#define SYS_VERSION_BUILD_INT
Definition: SYS_Version.h:41
#define SYS_VERSION_MINOR
Definition: SYS_Version.h:34
#define SYS_VERSION_FULL
Definition: SYS_Version.h:27
#define SYS_VERSION_PATCH
Definition: SYS_Version.h:36
#define SYS_VERSION_MAJOR
Definition: SYS_Version.h:33
#define SYS_VERSION_PATCH_INT
Definition: SYS_Version.h:42