2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 //////////////////////////////////////////////////////////////////////////////////////////////////
19 /// \brief Header for CFrameworkunifiedVersion class
20 //////////////////////////////////////////////////////////////////////////////////////////////////
23 * @file ns_version_if.h
24 * @brief \~english Header for CFrameworkunifiedVersion class
27 #ifndef NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_ // NOLINT (build/header_guard)
28 #define NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_
29 #include <native_service/frameworkunified_types.h>
33 #include <other_service/strlcpy.h>
34 #include <other_service/strlcat.h>
39 /** @addtogroup BaseSystem
42 /** @addtogroup native_service
46 /** @addtogroup framework_unified
47 * @ingroup native_service
50 /** @addtogroup native
51 * @ingroup framework_unified
56 * @class CFrameworkunifiedVersion
57 * @brief \~english Version Info Class
58 * @par \~english Brief Introduction
59 * \~english This class provides functions to get various information of the version.
62 class CFrameworkunifiedVersion {
64 ////////////////////////////////////////////////////////////////////////////////////////////////
65 /// \ingroup NS_UtilityCenter
66 /// \~english @par Brief
67 /// Construct a CFrameworkunifiedVersion object.
68 /// \~english @par Prerequisite
70 /// \~english @par Change of internal state
72 /// \~english @par Conditions of processing failure
74 /// \~english @par Classification
76 /// \~english @par Type
78 /// \~english @par Detail
79 /// The function constructs a CFrameworkunifiedVersion object.
80 /// \~english @see ~CFrameworkunifiedVersion
81 ////////////////////////////////////////////////////////////////////////////////////////////////
82 CFrameworkunifiedVersion();
84 ///////////////////////////////////////////////////////////////////////////////////////////////
85 /// \ingroup NS_UtilityCenter
86 /// \~english @par Brief
87 /// Constructs a CFrameworkunifiedVersion object with parameters.
88 /// \~english @param[in] major
89 /// UI_16 - Major number of the application
90 /// \~english @param[in] minor
91 /// UI_16 - Minor number of the application
92 /// \~english @param[in] revision
93 /// UI_16 - Revision number of the application
94 /// \~english @par Prerequisite
96 /// \~english @par Change of internal state
98 /// \~english @par Conditions of processing failure
100 /// \~english @par Classification
102 /// \~english @par Type
104 /// \~english @par Detail
105 /// The function constructs a CFrameworkunifiedVersion object with parameters.
106 /// \~english @see ~CFrameworkunifiedVersion
107 ////////////////////////////////////////////////////////////////////////////////////////////////
108 CFrameworkunifiedVersion(UI_16 major, UI_16 minor, UI_16 revision);
110 ////////////////////////////////////////////////////////////////////////////////////////////////
111 /// \ingroup NS_UtilityCenter
112 /// \~english @par Brief
113 /// Destruct the CFrameworkunifiedVersion object.
114 /// \~english @par Prerequisite
116 /// \~english @par Change of internal state
118 /// \~english @par Conditions of processing failure
120 /// \~english @par Classification
122 /// \~english @par Type
124 /// \~english @par Detail
125 /// The function destructs the CFrameworkunifiedVersion object.
126 /// \~english @see CFrameworkunifiedVersion
127 ////////////////////////////////////////////////////////////////////////////////////////////////
128 virtual ~CFrameworkunifiedVersion();
130 ////////////////////////////////////////////////////////////////////////////////////////////////
131 /// \ingroup NS_UtilityCenter
132 /// \~english @par Brief
133 /// Get the data number
134 /// \~english @param [in] a
135 /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against b.
136 /// \~english @param [in] b
137 /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against a.
138 /// \~english @retval TRUE: Match, FALSE: Does not Match
140 /// \~english @par Prerequisite
142 /// \~english @par Change of internal state
144 /// \~english @par Conditions of processing failure
146 /// \~english @par Classification
148 /// \~english @par Type
150 /// \~english @par Detail
151 /// The function is a friend function of the class. \n
152 /// The function checks whether the object matchs the other or not. Match: returns TRUE, \n
153 /// Does not match: returns FALSE.
154 /// \~english @see operator ==
155 ////////////////////////////////////////////////////////////////////////////////////////////////
156 friend BOOL operator == (CFrameworkunifiedVersion &a, CFrameworkunifiedVersion &b); // NOLINT (readability/nolint)
158 ////////////////////////////////////////////////////////////////////////////////////////////////
159 /// \ingroup NS_UtilityCenter
160 /// \~english @par Brief
161 /// Get the data number
162 /// \~english @param [in] f_test_i
163 /// CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against this obj.
164 /// \~english @retval TRUE: Match, FALSE: Does not Match
166 /// \~english @par Prerequisite
168 /// \~english @par Change of internal state
170 /// \~english @par Conditions of processing failure
172 /// \~english @par Classification
174 /// \~english @par Type
176 /// \~english @par Detail
177 /// The function checks whether the object matchs the other or not. Match: returns TRUE, \n
178 /// Does not match: returns FALSE.
180 ////////////////////////////////////////////////////////////////////////////////////////////////
181 BOOL operator == (const CFrameworkunifiedVersion &f_test_i); // NOLINT (readability/nolint)
183 ////////////////////////////////////////////////////////////////////////////////////////////////
184 /// \ingroup NS_UtilityCenter
185 /// \~english @par Brief
186 /// Get the version as string
187 /// \~english @retval the vision string
189 /// \~english @par Prerequisite
191 /// \~english @par Change of internal state
193 /// \~english @par Conditions of processing failure
195 /// \~english @par Classification
197 /// \~english @par Type
199 /// \~english @par Detail
200 /// The function returns the version string.
202 ////////////////////////////////////////////////////////////////////////////////////////////////
205 ////////////////////////////////////////////////////////////////////////////////////////////////
206 /// \ingroup NS_UtilityCenter
207 /// \~english @par Brief
208 /// Get the date as string
209 /// \~english @retval the date string
211 /// \~english @par Prerequisite
213 /// \~english @par Change of internal state
215 /// \~english @par Conditions of processing failure
217 /// \~english @par Classification
219 /// \~english @par Type
221 /// \~english @par Detail
222 /// The function returns the date when building.
224 ////////////////////////////////////////////////////////////////////////////////////////////////
227 ////////////////////////////////////////////////////////////////////////////////////////////////
228 /// \ingroup NS_UtilityCenter
229 /// \~english @par Brief
230 /// Get the signature number
231 /// \~english @retval the signature
233 /// \~english @par Prerequisite
235 /// \~english @par Change of internal state
237 /// \~english @par Conditions of processing failure
239 /// \~english @par Classification
241 /// \~english @par Type
243 /// \~english @par Detail
244 /// The function returns the signature number.
246 ////////////////////////////////////////////////////////////////////////////////////////////////
247 UI_32 Signature() const;
249 ////////////////////////////////////////////////////////////////////////////////////////////////
250 /// \ingroup NS_UtilityCenter
251 /// \~english @par Brief
252 /// Get the structure version number
253 /// \~english @retval the structure version number
255 /// \~english @par Prerequisite
257 /// \~english @par Change of internal state
259 /// \~english @par Conditions of processing failure
261 /// \~english @par Classification
263 /// \~english @par Type
265 /// \~english @par Detail
266 /// The function returns the structure version number.
268 ////////////////////////////////////////////////////////////////////////////////////////////////
269 UI_32 StrucVersion() const;
271 ////////////////////////////////////////////////////////////////////////////////////////////////
272 /// \ingroup NS_UtilityCenter
273 /// \~english @par Brief
274 /// Get the product version
275 /// \~english @retval the product version
277 /// \~english @par Prerequisite
279 /// \~english @par Change of internal state
281 /// \~english @par Conditions of processing failure
283 /// \~english @par Classification
285 /// \~english @par Type
287 /// \~english @par Detail
288 /// The function returns the product version.
290 ////////////////////////////////////////////////////////////////////////////////////////////////
291 UI_32 ProductVersion() const;
293 ////////////////////////////////////////////////////////////////////////////////////////////////
294 /// \ingroup NS_UtilityCenter
295 /// \~english @par Brief
296 /// Get the date as number
297 /// \~english @retval the date number
299 /// \~english @par Prerequisite
301 /// \~english @par Change of internal state
303 /// \~english @par Conditions of processing failure
305 /// \~english @par Classification
307 /// \~english @par Type
309 /// \~english @par Detail
310 /// The function returns the date as number.
312 ////////////////////////////////////////////////////////////////////////////////////////////////
315 ////////////////////////////////////////////////////////////////////////////////////////////////
316 /// \ingroup NS_UtilityCenter
317 /// \~english @par Brief
318 /// Get the major verion number
319 /// \~english @retval the major version number
321 /// \~english @par Prerequisite
323 /// \~english @par Change of internal state
325 /// \~english @par Conditions of processing failure
327 /// \~english @par Classification
329 /// \~english @par Type
331 /// \~english @par Detail
332 /// The function returns the major version number.
334 ////////////////////////////////////////////////////////////////////////////////////////////////
337 ////////////////////////////////////////////////////////////////////////////////////////////////
338 /// \ingroup NS_UtilityCenter
339 /// \~english @par Brief
340 /// Get the minor version number
341 /// \~english @retval the minor version number
343 /// \~english @par Prerequisite
345 /// \~english @par Change of internal state
347 /// \~english @par Conditions of processing failure
349 /// \~english @par Classification
351 /// \~english @par Type
353 /// \~english @par Detail
354 /// The function returns the minor version number.
356 ////////////////////////////////////////////////////////////////////////////////////////////////
359 ////////////////////////////////////////////////////////////////////////////////////////////////
360 /// \ingroup NS_UtilityCenter
361 /// \~english @par Brief
362 /// Get the unique product identifier
363 /// \~english @retval the revision number
365 /// \~english @par Prerequisite
367 /// \~english @par Change of internal state
369 /// \~english @par Conditions of processing failure
371 /// \~english @par Classification
373 /// \~english @par Type
375 /// \~english @par Detail
376 /// The function returns the unique product identifier generated by the build server.
378 ////////////////////////////////////////////////////////////////////////////////////////////////
379 PCSTR Product() const;
381 ////////////////////////////////////////////////////////////////////////////////////////////////
382 /// \ingroup NS_UtilityCenter
383 /// \~english @par Brief
384 /// Get the building version string
385 /// \~english @retval the building version string
387 /// \~english @par Prerequisite
389 /// \~english @par Change of internal state
391 /// \~english @par Conditions of processing failure
393 /// \~english @par Classification
395 /// \~english @par Type
397 /// \~english @par Detail
398 /// The function returns the unique build identifier generated by the build server.
400 ////////////////////////////////////////////////////////////////////////////////////////////////
403 ////////////////////////////////////////////////////////////////////////////////////////////////
404 /// \ingroup NS_UtilityCenter
405 /// \~english @par Brief
406 /// Get the revision number
407 /// \~english @retval the revision number
409 /// \~english @par Prerequisite
411 /// \~english @par Change of internal state
413 /// \~english @par Conditions of processing failure
415 /// \~english @par Classification
417 /// \~english @par Type
419 /// \~english @par Detail
420 /// The function returns the revision as number.
421 /// \~english @see CFrameworkunifiedVersion
422 ////////////////////////////////////////////////////////////////////////////////////////////////
423 UI_16 Revision() const;
426 CFrameworkunifiedVersion(const CFrameworkunifiedVersion &);
427 CFrameworkunifiedVersion &operator= (const CFrameworkunifiedVersion &); // NOLINT (readability/nolint)
431 UI_32 u32_struc_version;
432 UI_32 u32_product_version;
438 VersionInfo(PSTR p, UI_32 a, UI_32 b, UI_32 c, UI_32 d, UI_16 e, UI_16 f , PSTR g, UI_16 h) :
440 u32_struc_version(b),
441 u32_product_version(c),
446 size_t length = strlen(p) + 1;
447 p_str_product = new CHAR[length]; // LCOV_EXCL_BR_LINE 11:except branch
448 if (NULL != p_str_product) { // LCOV_EXCL_BR_LINE 5:new's error case
449 memset(p_str_product, 0, length);
450 #ifdef AGL_PosixBasedOS001LEGACY_USED
451 strlcpy(p_str_product, p, length);
455 length = strlen(g) + 1;
456 p_str_build = new CHAR[length]; // LCOV_EXCL_BR_LINE 11:except branch
457 if (NULL != p_str_build) { // LCOV_EXCL_BR_LINE 5:new's error case
458 memset(p_str_build, 0, length);
459 #ifdef AGL_PosixBasedOS001LEGACY_USED
460 strlcpy(p_str_build, g , length);
465 delete[] p_str_product; // LCOV_EXCL_BR_LINE 11:except branch
466 p_str_product = NULL;
467 delete[] p_str_build; // LCOV_EXCL_BR_LINE 11:except branch
477 * \~english define macro for version string
479 #define FRAMEWORKUNIFIED_GET_VERSION() "undefined_undefined_00.00.00"
482 * \~english define macro for the major number of the version
484 #define FRAMEWORKUNIFIED_APP_VERSION_MAJOR() (0)
487 * \~english define macro for the minor number of the version
489 #define FRAMEWORKUNIFIED_APP_VERSION_MINOR() (0)
492 * \~english define macro for the revision number
494 #define FRAMEWORKUNIFIED_APP_VERSION_REVISION() (0)
497 * \~english define macro for the building version
499 #define FRAMEWORKUNIFIED_APP_VERSION_BUILDVER() "undefined"
502 * \~english define macro for product version
504 #define FRAMEWORKUNIFIED_APP_VERSION_PRODUCTID() "undefined"
506 #endif // NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_ // NOLINT (build/header_guard)
507 /** @}*/ // end of native
508 /** @}*/ // end of framework_unified
509 /** @}*/ // end of native_service
510 /** @}*/ // end of BaseSystem