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