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