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