]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ******************************************************************************* | |
729e4ab9 | 3 | * Copyright (C) 2000-2010, International Business Machines |
b75a7d8f A |
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 | * | |
b75a7d8f A |
14 | * Gets included by utypes.h and Windows .rc files |
15 | */ | |
16 | ||
73c04bcf A |
17 | /** |
18 | * \file | |
729e4ab9 | 19 | * \brief C API: API for accessing ICU version numbers. |
73c04bcf | 20 | */ |
b75a7d8f A |
21 | /*===========================================================================*/ |
22 | /* Main ICU version information */ | |
23 | /*===========================================================================*/ | |
24 | ||
25 | #ifndef UVERSION_H | |
26 | #define UVERSION_H | |
27 | ||
b75a7d8f A |
28 | #include "unicode/umachine.h" |
29 | ||
729e4ab9 A |
30 | /* Actual version info lives in uvernum.h */ |
31 | #include "unicode/uvernum.h" | |
b75a7d8f A |
32 | |
33 | /** Maximum length of the copyright string. | |
374ca955 | 34 | * @stable ICU 2.4 |
b75a7d8f A |
35 | */ |
36 | #define U_COPYRIGHT_STRING_LENGTH 128 | |
37 | ||
b75a7d8f | 38 | /** An ICU version consists of up to 4 numbers from 0..255. |
374ca955 | 39 | * @stable ICU 2.4 |
b75a7d8f A |
40 | */ |
41 | #define U_MAX_VERSION_LENGTH 4 | |
42 | ||
43 | /** In a string, ICU version fields are delimited by dots. | |
374ca955 | 44 | * @stable ICU 2.4 |
b75a7d8f A |
45 | */ |
46 | #define U_VERSION_DELIMITER '.' | |
47 | ||
48 | /** The maximum length of an ICU version string. | |
374ca955 | 49 | * @stable ICU 2.4 |
b75a7d8f A |
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. | |
729e4ab9 | 54 | * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). |
374ca955 | 55 | * @stable ICU 2.4 |
b75a7d8f A |
56 | */ |
57 | typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; | |
58 | ||
46f4442e A |
59 | /*===========================================================================*/ |
60 | /* C++ namespace if supported. Versioned unless versioning is disabled. */ | |
61 | /*===========================================================================*/ | |
73c04bcf | 62 | |
46f4442e A |
63 | /** |
64 | * \def U_NAMESPACE_BEGIN | |
65 | * This is used to begin a declaration of a public ICU C++ API. | |
729e4ab9 A |
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 | * If the C++ compiler supports namespaces, it also begins a namespace block. | |
46f4442e A |
71 | * @stable ICU 2.4 |
72 | */ | |
73c04bcf | 73 | |
46f4442e A |
74 | /** |
75 | * \def U_NAMESPACE_END | |
729e4ab9 A |
76 | * This is used to end a declaration of a public ICU C++ API. |
77 | * When not compiling for C++, it does nothing. | |
78 | * When compiling for C++, it ends the extern "C++" block begun by | |
79 | * U_NAMESPACE_BEGIN. | |
80 | * If the C++ compiler supports namespaces, it also ends the namespace block | |
81 | * begun by U_NAMESPACE_BEGIN. | |
46f4442e A |
82 | * @stable ICU 2.4 |
83 | */ | |
b75a7d8f | 84 | |
46f4442e A |
85 | /** |
86 | * \def U_NAMESPACE_USE | |
87 | * This is used to specify that the rest of the code uses the | |
88 | * public ICU C++ API namespace. | |
89 | * If the compiler doesn't support namespaces, this does nothing. | |
90 | * @stable ICU 2.4 | |
91 | */ | |
92 | ||
93 | /** | |
94 | * \def U_NAMESPACE_QUALIFIER | |
95 | * This is used to qualify that a function or class is part of | |
96 | * the public ICU C++ API namespace. | |
97 | * If the compiler doesn't support namespaces, this does nothing. | |
98 | * @stable ICU 2.4 | |
99 | */ | |
100 | ||
101 | /* Define namespace symbols if the compiler supports it. */ | |
729e4ab9 A |
102 | #ifdef XP_CPLUSPLUS |
103 | #if U_HAVE_NAMESPACE | |
46f4442e A |
104 | # if U_DISABLE_RENAMING |
105 | # define U_ICU_NAMESPACE icu | |
106 | namespace U_ICU_NAMESPACE { } | |
107 | # else | |
729e4ab9 | 108 | # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) |
46f4442e A |
109 | namespace U_ICU_NAMESPACE { } |
110 | namespace icu = U_ICU_NAMESPACE; | |
111 | # endif | |
112 | ||
729e4ab9 A |
113 | # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE { |
114 | # define U_NAMESPACE_END } } | |
46f4442e A |
115 | # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; |
116 | # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: | |
117 | ||
118 | # ifndef U_USING_ICU_NAMESPACE | |
119 | # define U_USING_ICU_NAMESPACE 1 | |
120 | # endif | |
121 | # if U_USING_ICU_NAMESPACE | |
122 | U_NAMESPACE_USE | |
123 | # endif | |
124 | #else | |
729e4ab9 A |
125 | # define U_NAMESPACE_BEGIN extern "C++" { |
126 | # define U_NAMESPACE_END } | |
127 | # define U_NAMESPACE_USE | |
128 | # define U_NAMESPACE_QUALIFIER | |
129 | #endif | |
130 | #else | |
46f4442e A |
131 | # define U_NAMESPACE_BEGIN |
132 | # define U_NAMESPACE_END | |
133 | # define U_NAMESPACE_USE | |
134 | # define U_NAMESPACE_QUALIFIER | |
73c04bcf A |
135 | #endif |
136 | ||
b75a7d8f A |
137 | /*===========================================================================*/ |
138 | /* General version helper functions. Definitions in putil.c */ | |
139 | /*===========================================================================*/ | |
140 | ||
141 | /** | |
142 | * Parse a string with dotted-decimal version information and | |
143 | * fill in a UVersionInfo structure with the result. | |
144 | * Definition of this function lives in putil.c | |
145 | * | |
146 | * @param versionArray The destination structure for the version information. | |
147 | * @param versionString A string with dotted-decimal version information, | |
148 | * with up to four non-negative number fields with | |
149 | * values of up to 255 each. | |
374ca955 | 150 | * @stable ICU 2.4 |
b75a7d8f | 151 | */ |
374ca955 | 152 | U_STABLE void U_EXPORT2 |
b75a7d8f A |
153 | u_versionFromString(UVersionInfo versionArray, const char *versionString); |
154 | ||
729e4ab9 A |
155 | /** |
156 | * Parse a Unicode string with dotted-decimal version information and | |
157 | * fill in a UVersionInfo structure with the result. | |
158 | * Definition of this function lives in putil.c | |
159 | * | |
160 | * @param versionArray The destination structure for the version information. | |
161 | * @param versionString A Unicode string with dotted-decimal version | |
162 | * information, with up to four non-negative number | |
163 | * fields with values of up to 255 each. | |
164 | * @stable ICU 4.2 | |
165 | */ | |
166 | U_STABLE void U_EXPORT2 | |
167 | u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); | |
168 | ||
169 | ||
b75a7d8f A |
170 | /** |
171 | * Write a string with dotted-decimal version information according | |
172 | * to the input UVersionInfo. | |
173 | * Definition of this function lives in putil.c | |
174 | * | |
175 | * @param versionArray The version information to be written as a string. | |
176 | * @param versionString A string buffer that will be filled in with | |
177 | * a string corresponding to the numeric version | |
178 | * information in versionArray. | |
179 | * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. | |
374ca955 | 180 | * @stable ICU 2.4 |
b75a7d8f | 181 | */ |
374ca955 | 182 | U_STABLE void U_EXPORT2 |
b75a7d8f A |
183 | u_versionToString(UVersionInfo versionArray, char *versionString); |
184 | ||
185 | /** | |
186 | * Gets the ICU release version. The version array stores the version information | |
187 | * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. | |
188 | * Definition of this function lives in putil.c | |
189 | * | |
190 | * @param versionArray the version # information, the result will be filled in | |
191 | * @stable ICU 2.0 | |
192 | */ | |
374ca955 | 193 | U_STABLE void U_EXPORT2 |
b75a7d8f | 194 | u_getVersion(UVersionInfo versionArray); |
b75a7d8f | 195 | #endif |