1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html |
3 | /* |
4 | ******************************************************************************* |
5 | * Copyright (C) 2000-2011, International Business Machines |
6 | * Corporation and others. All Rights Reserved. |
7 | ******************************************************************************* |
8 | * |
9 | * file name: uversion.h |
10 | * encoding: UTF-8 |
11 | * tab size: 8 (not used) |
12 | * indentation:4 |
13 | * |
14 | * Created by: Vladimir Weinstein |
15 | * |
16 | * Gets included by utypes.h and Windows .rc files |
17 | */ |
18 | |
19 | /** |
20 | * \file |
21 | * \brief C API: API for accessing ICU version numbers. |
22 | */ |
23 | /*===========================================================================*/ |
24 | /* Main ICU version information */ |
25 | /*===========================================================================*/ |
26 | |
27 | #ifndef UVERSION_H |
28 | #define UVERSION_H |
29 | |
30 | #include "unicode/umachine.h" |
31 | |
32 | /* Actual version info lives in uvernum.h */ |
33 | #include "unicode/uvernum.h" |
34 | |
35 | /** Maximum length of the copyright string. |
36 | * @stable ICU 2.4 |
37 | */ |
38 | #define U_COPYRIGHT_STRING_LENGTH 128 |
39 | |
40 | /** An ICU version consists of up to 4 numbers from 0..255. |
41 | * @stable ICU 2.4 |
42 | */ |
43 | #define U_MAX_VERSION_LENGTH 4 |
44 | |
45 | /** In a string, ICU version fields are delimited by dots. |
46 | * @stable ICU 2.4 |
47 | */ |
48 | #define U_VERSION_DELIMITER '.' |
49 | |
50 | /** The maximum length of an ICU version string. |
51 | * @stable ICU 2.4 |
52 | */ |
53 | #define U_MAX_VERSION_STRING_LENGTH 20 |
54 | |
55 | /** The binary form of a version on ICU APIs is an array of 4 uint8_t. |
56 | * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). |
57 | * @stable ICU 2.4 |
58 | */ |
59 | typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; |
60 | |
61 | /*===========================================================================*/ |
62 | /* C++ namespace if supported. Versioned unless versioning is disabled. */ |
63 | /*===========================================================================*/ |
64 | |
65 | /** |
66 | * \def U_NAMESPACE_BEGIN |
67 | * This is used to begin a declaration of a public ICU C++ API. |
68 | * When not compiling for C++, it does nothing. |
69 | * When compiling for C++, it begins an extern "C++" linkage block (to protect |
70 | * against cases in which an external client includes ICU header files inside |
71 | * an extern "C" linkage block). |
72 | * |
73 | * It also begins a versioned-ICU-namespace block. |
74 | * @stable ICU 2.4 |
75 | */ |
76 | |
77 | /** |
78 | * \def U_NAMESPACE_END |
79 | * This is used to end a declaration of a public ICU C++ API. |
80 | * When not compiling for C++, it does nothing. |
81 | * When compiling for C++, it ends the extern "C++" block begun by |
82 | * U_NAMESPACE_BEGIN. |
83 | * |
84 | * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. |
85 | * @stable ICU 2.4 |
86 | */ |
87 | |
88 | /** |
89 | * \def U_NAMESPACE_USE |
90 | * This is used to specify that the rest of the code uses the |
91 | * public ICU C++ API namespace. |
92 | * This is invoked by default; we recommend that you turn it off: |
93 | * See the "Recommended Build Options" section of the ICU4C readme |
94 | * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild) |
95 | * @stable ICU 2.4 |
96 | */ |
97 | |
98 | /** |
99 | * \def U_NAMESPACE_QUALIFIER |
100 | * This is used to qualify that a function or class is part of |
101 | * the public ICU C++ API namespace. |
102 | * |
103 | * This macro is unnecessary since ICU 49 requires namespace support. |
104 | * You can just use "icu::" instead. |
105 | * @stable ICU 2.4 |
106 | */ |
107 | |
108 | /* Define C++ namespace symbols. */ |
109 | #ifdef __cplusplus |
110 | # if U_DISABLE_RENAMING |
111 | # define U_ICU_NAMESPACE icu |
112 | namespace U_ICU_NAMESPACE { } |
113 | # else |
114 | # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) |
115 | namespace U_ICU_NAMESPACE { } |
116 | namespace icu = U_ICU_NAMESPACE; |
117 | # endif |
118 | |
119 | # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE { |
120 | # define U_NAMESPACE_END } } |
121 | # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; |
122 | # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: |
123 | |
124 | # ifndef U_USING_ICU_NAMESPACE |
125 | # if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ |
126 | defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ |
127 | defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) |
128 | # define U_USING_ICU_NAMESPACE 0 |
129 | # else |
130 | # define U_USING_ICU_NAMESPACE 0 |
131 | # endif |
132 | # endif |
133 | # if U_USING_ICU_NAMESPACE |
134 | U_NAMESPACE_USE |
135 | # endif |
136 | #else |
137 | # define U_NAMESPACE_BEGIN |
138 | # define U_NAMESPACE_END |
139 | # define U_NAMESPACE_USE |
140 | # define U_NAMESPACE_QUALIFIER |
141 | #endif |
142 | |
143 | /*===========================================================================*/ |
144 | /* General version helper functions. Definitions in putil.c */ |
145 | /*===========================================================================*/ |
146 | |
147 | /** |
148 | * Parse a string with dotted-decimal version information and |
149 | * fill in a UVersionInfo structure with the result. |
150 | * Definition of this function lives in putil.c |
151 | * |
152 | * @param versionArray The destination structure for the version information. |
153 | * @param versionString A string with dotted-decimal version information, |
154 | * with up to four non-negative number fields with |
155 | * values of up to 255 each. |
156 | * @stable ICU 2.4 |
157 | */ |
158 | U_STABLE void U_EXPORT2 |
159 | u_versionFromString(UVersionInfo versionArray, const char *versionString); |
160 | |
161 | /** |
162 | * Parse a Unicode string with dotted-decimal version information and |
163 | * fill in a UVersionInfo structure with the result. |
164 | * Definition of this function lives in putil.c |
165 | * |
166 | * @param versionArray The destination structure for the version information. |
167 | * @param versionString A Unicode string with dotted-decimal version |
168 | * information, with up to four non-negative number |
169 | * fields with values of up to 255 each. |
170 | * @stable ICU 4.2 |
171 | */ |
172 | U_STABLE void U_EXPORT2 |
173 | u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); |
174 | |
175 | |
176 | /** |
177 | * Write a string with dotted-decimal version information according |
178 | * to the input UVersionInfo. |
179 | * Definition of this function lives in putil.c |
180 | * |
181 | * @param versionArray The version information to be written as a string. |
182 | * @param versionString A string buffer that will be filled in with |
183 | * a string corresponding to the numeric version |
184 | * information in versionArray. |
185 | * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. |
186 | * @stable ICU 2.4 |
187 | */ |
188 | U_STABLE void U_EXPORT2 |
189 | u_versionToString(const UVersionInfo versionArray, char *versionString); |
190 | |
191 | /** |
192 | * Gets the ICU release version. The version array stores the version information |
193 | * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. |
194 | * Definition of this function lives in putil.c |
195 | * |
196 | * @param versionArray the version # information, the result will be filled in |
197 | * @stable ICU 2.0 |
198 | */ |
199 | U_STABLE void U_EXPORT2 |
200 | u_getVersion(UVersionInfo versionArray); |
201 | #endif |
202 | |