]> vaikene.ee Git - evaf/blob - src/libs/version_rc.h
Ported to Qt5
[evaf] / src / libs / version_rc.h
1 /**
2 * @file version_rc.h
3 * @brief Global version information for eVaf applications and modules
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011-2012 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #ifndef __VERSION_RC_H
21 #define __VERSION_RC_H
22
23 #include <QtCore/qglobal.h>
24
25 /**
26 * Product's version number in the format major,minor,release
27 */
28 #ifndef VER_PRODUCT_VERSION
29 # define VER_PRODUCT_VERSION 0,1,1
30 #endif
31
32 /**
33 * Product's version number in the human-readable format (shall end with \0)
34 */
35 #ifndef VER_PRODUCT_VERSION_STR
36 # define VER_PRODUCT_VERSION_STR "0.1.1\0"
37 #endif
38
39 /**
40 * Product's name (shall end with \0)
41 */
42 #ifndef VER_PRODUCT_NAME_STR
43 # define VER_PRODUCT_NAME_STR "eVaf\0"
44 #endif
45
46 /**
47 * Product's release date (shall end with \0)
48 */
49 #ifndef VER_PRODUCT_DATE_STR
50 # define VER_PRODUCT_DATE_STR "N/A\0"
51 #endif
52
53 /**
54 * Legal copyright (shall end with \0)
55 */
56 #ifndef VER_LEGAL_COPYRIGHT_STR
57 # define VER_LEGAL_COPYRIGHT_STR "(C) 2011-2012 Enar Vaikene\0"
58 #endif
59
60 /**
61 * Name of the company (shall end with \0)
62 */
63 #ifndef VER_COMPANY_NAME_STR
64 # define VER_COMPANY_NAME_STR "eVaf\0"
65 #endif
66
67 /**
68 * Generic type for modules.
69 * The string version shall end with \0.
70 */
71 #define MT_GENERIC 0
72 #define MT_GENERIC_STR "generic\0"
73
74 /**
75 * Version info structure for modules.
76 *
77 * All the eVaf modules include this version info structure so that their version numbers,
78 * purposes etc can be retrieved before loading the module.
79 */
80 struct ModuleVersionInfo
81 {
82 /**
83 * Type of the module.
84 *
85 * This value can be used to group modules by their purpose. For example, if all the communication
86 * modules had the same module type value, then this value can be used to determine, which modules
87 * should be shown in a list of available communication modules.
88 *
89 * The exact meaning of the type is up to the application. Generic modules should use the type
90 * MT_GENERIC.
91 */
92 uint const type;
93
94 /**
95 * Name of the module.
96 *
97 * A short name of the module.
98 */
99 char const * const name;
100
101 /**
102 * 4-digit version number of the module in the format major,minor,release,build
103 */
104 uint const version[4];
105
106 /**
107 * Human-readable version number of the module.
108 */
109 char const * const versionStr;
110
111 /**
112 * Description of the module.
113 *
114 * A longer description explaining the purpose of the module.
115 */
116 char const * const description;
117
118 /**
119 * Name of the product.
120 *
121 * If the module is part of a product, then this field holds the name of the product.
122 */
123 char const * const prodName;
124
125 /**
126 * 3-digit product version number in the format major,minor,release
127 *
128 * If the module is part of a product, then this field holds the version number
129 * of the product.
130 */
131 uint const prodVersion[3];
132
133 /**
134 * Human-readable product version number of the product.
135 */
136 char const * const prodVersionStr;
137
138 /**
139 * Human-readable release date of the product.
140 *
141 * If the module is part of a product, then this field holds the release date
142 * of the product.
143 */
144 char const * const prodDateStr;
145
146 /**
147 * Legal copyright.
148 */
149 char const * const copyright;
150
151 /**
152 * Name of the company.
153 */
154 char const * const company;
155
156 };
157
158 #ifndef C_EXTERN_C
159 # ifdef __cplusplus
160 # define C_EXTERN_C extern "C"
161 # else
162 # define C_EXTERN_C
163 # endif
164 #endif
165
166 /**
167 * Function prototype that returns version information from a module.
168 *
169 * This is a typedef for a pointer to a function with the following signature:
170 * @code
171 * void queryVersionInfo(ModuleVersionInfo **);
172 * @endcode
173 *
174 * Every eVaf module is expected to export this function and the version info shall
175 * be available without any extra initialization.
176 *
177 * The function copies the address of the ModuleVersionInfo structure to the variable at ptr.
178 */
179 typedef void (* ModuleQueryVersionInfoFunction)(ModuleVersionInfo ** ptr);
180
181 /**
182 * Macro that exports version information from modules.
183 *
184 * At least the following macros describing the module shall be defined for this macro to work properly:
185 * @li VER_MODULE_TYPE
186 * @li VER_MODULE_NAME_STR
187 * @li VER_FILE_VERSION
188 * @li VER_FILE_VERSION_STR
189 * @li VER_FILE_DESCRIPTION_STR
190 *
191 * Additional macros describing the product are:
192 * @li VER_PRODUCT_NAME_STR
193 * @li VER_PRODUCT_VERSION
194 * @li VER_PRODUCT_VERSION_STR
195 * @li VER_PRODUCT_DATE_STR
196 *
197 * And some legal stuff:
198 * @li VER_LEGAL_COPYRIGHT_STR
199 * @li VER_COMPANY_NAME_STR
200 */
201 #define VER_EXPORT_VERSION_INFO() \
202 C_EXTERN_C Q_DECL_EXPORT void moduleQueryVersionInfo(ModuleVersionInfo ** ptr) \
203 { \
204 static ModuleVersionInfo ver = { VER_MODULE_TYPE, \
205 VER_MODULE_NAME_STR, \
206 { VER_FILE_VERSION }, \
207 VER_FILE_VERSION_STR, \
208 VER_FILE_DESCRIPTION_STR, \
209 VER_PRODUCT_NAME_STR, \
210 { VER_PRODUCT_VERSION }, \
211 VER_PRODUCT_VERSION_STR, \
212 VER_PRODUCT_DATE_STR, \
213 VER_LEGAL_COPYRIGHT_STR, \
214 VER_COMPANY_NAME_STR \
215 }; \
216 *ptr = &ver; \
217 }
218
219 #endif // version_rc.h