Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
VersionDefs.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Common_VersionDefs_h_
5#define _Stroika_Foundation_Common_VersionDefs_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#if defined(__cplusplus)
10#include <cstdint>
11#endif
12
13/**
14 * \file
15 *
16 * \note Code-Status: <a href="Code-Status.md#Release">Release</a>
17 *
18 * This file defines the part of the version stuff that can be safely included anywhere - even in a
19 * non-C++ file (e.g. resource compiler).
20 */
21
22#if defined(__cplusplus)
24#endif
25
26#if defined(__cplusplus)
27 /**
28 * Format
29 * |MAJOR|MINOR|STAGE|SubStage|Final|
30 * 32 24 16 13 1 0
31 * width 8 8 3 12 1
32 *
33 * \note When looking at a Binary32BitFullVersionType as bytes,
34 * high order byte = MAJOR
35 * next byte = MINOR
36 * next nibble (1/2 byte):
37 * kStroika_Version_Stage_Dev (kStroika_Version_Stage_Dev<<1) => 0x2
38 * kStroika_Version_Stage_Alpha (kStroika_Version_Stage_Alpha<<1) => 0x4
39 * kStroika_Version_Stage_Beta (kStroika_Version_Stage_Beta<<1) => 0x6
40 * kStroika_Version_Stage_ReleaseCandidate (kStroika_Version_Stage_ReleaseCandidate<<1) => 0x8
41 * kStroika_Version_Stage_Release (kStroika_Version_Stage_Release<<1) => 0xa
42 * low order bit part of substage but generally zero and ignoreable
43 * next nibble - part of substage but generally zero and ignorable
44 * next byte - low order 8 bits of substage << 1, so take that # and shift right (divide by 2) to get substage
45 * low order bit boolean for 'final build' versus dev-builds
46 *
47 * So Release 1.2b4 would be (in decimal place separated octets):
48 * 1.2.96.9 (in hex 0x1.0x2.0x60.0x9)
49 *
50 * So Release 3.0 would be (in decimal place separated octets):
51 * 3.0.160.1 (in hex 0x3.0x0.0xa0.0x1)
52 *
53 * So Release 3.0.1 would be (in decimal place separated octets):
54 * 3.0.160.3 (in hex 0x3.0x0.0xa0.0x3)
55 *
56 * \note
57 * Format UNTIL Stroika v2.0a151
58 * |MAJOR|MINOR|STAGE|SubStage|Final|
59 * 32 25 17 9 1 0
60 * width 7 8 8 8 1
61 */
62 using Binary32BitFullVersionType = uint32_t;
63#endif
64
65 /**
66 * We use a MACRO here so we can use in languages other than C++, and so we can use these in #if macro pre-processor commands.
67 */
68#define kStroika_Version_Stage_Dev 0x1
69#define kStroika_Version_Stage_Alpha 0x2
70#define kStroika_Version_Stage_Beta 0x3
71#define kStroika_Version_Stage_ReleaseCandidate 0x4
72#define kStroika_Version_Stage_Release 0x5
73
74 /**
75 * We use a MACRO here so we can use in languages other than C++, and so we can use these in #if macro pre-processor commands.
76 * @see Binary32BitFullVersionType for bit layout
77 *
78 * \par Example Usage
79 * \code
80 * // be sure to #include "Stroika/Foundation/Common/StroikaVersion.h" for kStroika_Version_FullVersion else kStroika_Version_FullVersion acts as if 0, and always use old code
81 * #if kStroika_Version_FullVersion >= Stroika_Make_FULL_VERSION (2, 0, kStroika_Version_Stage_Alpha, 156, 0)
82 * use new function;
83 * #else
84 * use older API
85 * #endif
86 * \endcode
87 */
88#define Stroika_Make_FULL_VERSION(_Major_, _Minor_, _Stage_, _SubStage_, _FinalBuild_) \
89 ((_Major_ << 24) | (_Minor_ << 16) | (_Stage_ << 13) | (_SubStage_ << 1) | (_FinalBuild_))
90
91#if defined(__cplusplus)
92}
93#endif
94
95/*
96 ********************************************************************************
97 ***************************** Implementation Details ***************************
98 ********************************************************************************
99 */
100#include "VersionDefs.inl"
101
102#endif /*_Stroika_Foundation_Common_VersionDefs_h_*/