summaryrefslogtreecommitdiffstats
path: root/nsframework/framework_unified/client/include/native_service/ns_version_if.h
blob: d0f5172e961f506a2b835856b0856019c2368c79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


//////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief    Header for CFrameworkunifiedVersion class
//////////////////////////////////////////////////////////////////////////////////////////////////

/**
 * @file ns_version_if.h
* @brief \~english Header for CFrameworkunifiedVersion class
 */

#ifndef NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_  // NOLINT  (build/header_guard)
#define NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_
#include <native_service/frameworkunified_types.h>
#include <string.h>

#ifdef AGL_STUB
#include <other_service/strlcpy.h>
#include <other_service/strlcat.h>
#endif



/** @addtogroup BaseSystem
 *  @{
 */
/** @addtogroup native_service
 *  @ingroup BaseSystem
 *  @{
 */
/** @addtogroup framework_unified
 *  @ingroup native_service
 *  @{
 */
/** @addtogroup native
 *  @ingroup framework_unified
 *  @{
 */

/**
 * @class CFrameworkunifiedVersion
 * @brief \~english Version Info Class
 * @par   \~english Brief Introduction
 * \~english This class provides functions to get various information of the version.
 *
 */
class CFrameworkunifiedVersion {
 public:
  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Construct a CFrameworkunifiedVersion object.
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function constructs a CFrameworkunifiedVersion object.
  /// \~english @see ~CFrameworkunifiedVersion
  ////////////////////////////////////////////////////////////////////////////////////////////////
  CFrameworkunifiedVersion();

  ///////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///        Constructs a CFrameworkunifiedVersion object with parameters.
  /// \~english @param[in] major
  ///        UI_16 - Major number of the application
  /// \~english @param[in] minor
  ///        UI_16 - Minor number of the application
  /// \~english @param[in] revision
  ///        UI_16 - Revision number of the application
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function constructs a CFrameworkunifiedVersion object with parameters.
  /// \~english @see ~CFrameworkunifiedVersion
  ////////////////////////////////////////////////////////////////////////////////////////////////
  CFrameworkunifiedVersion(UI_16 major, UI_16 minor, UI_16 revision);

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Destruct the CFrameworkunifiedVersion object.
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function destructs the CFrameworkunifiedVersion object.
  /// \~english @see CFrameworkunifiedVersion
  ////////////////////////////////////////////////////////////////////////////////////////////////
  virtual ~CFrameworkunifiedVersion();

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the data number
  /// \~english @param [in] a
  ///       CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against b.
  /// \~english @param [in] b
  ///       CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against a.
  /// \~english @retval TRUE: Match, FALSE: Does not Match
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function is a friend function of the class. \n
  ///       The function checks whether the object matchs the other or not. Match: returns TRUE, \n
  ///       Does not match: returns FALSE.
  /// \~english @see operator ==
  ////////////////////////////////////////////////////////////////////////////////////////////////
  friend BOOL operator == (CFrameworkunifiedVersion &a, CFrameworkunifiedVersion &b);  // NOLINT (readability/nolint)

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the data number
  /// \~english @param [in] f_test_i
  ///       CFrameworkunifiedVersion - the CFrameworkunifiedVersion object that will be compared against this obj.
  /// \~english @retval TRUE: Match, FALSE: Does not Match
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function checks whether the object matchs the other or not. Match: returns TRUE, \n
  ///       Does not match: returns FALSE.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  BOOL operator == (const CFrameworkunifiedVersion &f_test_i); // NOLINT (readability/nolint)

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the version as string
  /// \~english @retval the vision string
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the version string.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  PCSTR VersionStr();

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the date as string
  /// \~english @retval the date string
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the date when building.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  PCSTR DateStr();

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the signature number
  /// \~english @retval the signature
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the signature number.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_32 Signature() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the structure version number
  /// \~english @retval the structure version number
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the structure version number.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_32 StrucVersion() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the product version
  /// \~english @retval the product version
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the product version.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_32 ProductVersion() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the date as number
  /// \~english @retval the date number
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the date as number.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_32 Date() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the major verion number
  /// \~english @retval the major version number
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the major version number.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_16 Major() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the minor version number
  /// \~english @retval the minor version number
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the minor version number.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_16 Minor() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the unique product identifier
  /// \~english @retval the revision number
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the unique product identifier generated by the build server.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  PCSTR Product() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the building version string
  /// \~english @retval the building version string
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the unique build identifier generated by the build server.
  /// \~english @see
  ////////////////////////////////////////////////////////////////////////////////////////////////
  PCSTR Build() const;

  ////////////////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup NS_UtilityCenter
  /// \~english @par Brief
  ///       Get the revision number
  /// \~english @retval the revision number
  ///
  /// \~english @par Prerequisite
  ///       - None
  /// \~english @par Change of internal state
  ///       - None
  /// \~english @par Conditions of processing failure
  ///       - None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       Sync Only
  /// \~english @par Detail
  ///       The function returns the revision as number.
  /// \~english @see CFrameworkunifiedVersion
  ////////////////////////////////////////////////////////////////////////////////////////////////
  UI_16 Revision() const;

 private:
  CFrameworkunifiedVersion(const CFrameworkunifiedVersion &);
  CFrameworkunifiedVersion &operator= (const CFrameworkunifiedVersion &);  // NOLINT (readability/nolint)
  struct VersionInfo {
    PSTR p_str_product;
    UI_32 u32_signature;
    UI_32 u32_struc_version;
    UI_32 u32_product_version;
    UI_32 u32_date;
    UI_16 u16_major;
    UI_16 u16_minor;
    PSTR p_str_build;
    UI_16 u16_revision;
    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) :
      u32_signature(a),
      u32_struc_version(b),
      u32_product_version(c),
      u32_date(d),
      u16_major(e),
      u16_minor(f),
      u16_revision(h) {
      size_t length = strlen(p) + 1;
      p_str_product = new CHAR[length];  // LCOV_EXCL_BR_LINE 11:except branch
      if (NULL != p_str_product) {  // LCOV_EXCL_BR_LINE 5:new's error case
        memset(p_str_product, 0, length);
#ifdef AGL_PosixBasedOS001LEGACY_USED
        strlcpy(p_str_product, p, length);
#endif
      }

      length = strlen(g) + 1;
      p_str_build = new CHAR[length];  // LCOV_EXCL_BR_LINE 11:except branch
      if (NULL != p_str_build) {  // LCOV_EXCL_BR_LINE 5:new's error case
        memset(p_str_build, 0, length);
#ifdef AGL_PosixBasedOS001LEGACY_USED
        strlcpy(p_str_build, g , length);
#endif
      }
    }
    ~VersionInfo() {
      delete[] p_str_product;  // LCOV_EXCL_BR_LINE 11:except branch
      p_str_product = NULL;
      delete[] p_str_build;  // LCOV_EXCL_BR_LINE 11:except branch
      p_str_build = NULL;
    }
  } m_tVersionInfo;
  UI_32 m_u32Month;
  UI_32 m_u32Year;
  UI_32 m_u32Day;
};

/**
 * \~english define macro for version string
 */
#define FRAMEWORKUNIFIED_GET_VERSION() "undefined_undefined_00.00.00"

/**
 * \~english define macro for the major number of the version
 */
#define FRAMEWORKUNIFIED_APP_VERSION_MAJOR() (0)

/**
 * \~english define macro for the minor number of the version
 */
#define FRAMEWORKUNIFIED_APP_VERSION_MINOR() (0)

/**
 * \~english define macro for the revision number
 */
#define FRAMEWORKUNIFIED_APP_VERSION_REVISION() (0)

/**
 * \~english define macro for the building version
 */
#define FRAMEWORKUNIFIED_APP_VERSION_BUILDVER() "undefined"

/**
 * \~english define macro for product version
 */
#define FRAMEWORKUNIFIED_APP_VERSION_PRODUCTID() "undefined"

#endif  // NS_NATIVESERVICES_INC_NATIVE_NS_VERSION_IF_H_  // NOLINT  (build/header_guard)
/** @}*/  // end of native
/** @}*/  // end of framework_unified
/** @}*/  // end of native_service
/** @}*/  // end of BaseSystem