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 * @addtogroup icu4c ICU4C 21 * @{ 22 * \file 23 * \brief C API: API for accessing ICU version numbers. 24 */ 25 /*===========================================================================*/ 26 /* Main ICU version information */ 27 /*===========================================================================*/ 28 29 #ifndef UVERSION_H 30 #define UVERSION_H 31 32 #include "unicode/umachine.h" 33 34 /* Actual version info lives in uvernum.h */ 35 #include "unicode/uvernum.h" 36 37 /** Maximum length of the copyright string. 38 * \xrefitem stable "Stable" "Stable List" ICU 2.4 39 */ 40 #define U_COPYRIGHT_STRING_LENGTH 128 41 42 /** An ICU version consists of up to 4 numbers from 0..255. 43 * \xrefitem stable "Stable" "Stable List" ICU 2.4 44 */ 45 #define U_MAX_VERSION_LENGTH 4 46 47 /** In a string, ICU version fields are delimited by dots. 48 * \xrefitem stable "Stable" "Stable List" ICU 2.4 49 */ 50 #define U_VERSION_DELIMITER '.' 51 52 /** The maximum length of an ICU version string. 53 * \xrefitem stable "Stable" "Stable List" ICU 2.4 54 */ 55 #define U_MAX_VERSION_STRING_LENGTH 20 56 57 /** The binary form of a version on ICU APIs is an array of 4 uint8_t. 58 * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). 59 * \xrefitem stable "Stable" "Stable List" ICU 2.4 60 */ 61 typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; 62 63 /*===========================================================================*/ 64 /* C++ namespace if supported. Versioned unless versioning is disabled. */ 65 /*===========================================================================*/ 66 67 /* Define C++ namespace symbols. */ 68 #ifdef __cplusplus 69 70 /** 71 * \def U_NAMESPACE_BEGIN 72 * This is used to begin a declaration of a public ICU C++ API within 73 * versioned-ICU-namespace block. 74 * 75 * \xrefitem stable "Stable" "Stable List" ICU 2.4 76 */ 77 78 /** 79 * \def U_NAMESPACE_END 80 * This is used to end a declaration of a public ICU C++ API. 81 * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. 82 * 83 * \xrefitem stable "Stable" "Stable List" 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 * \xrefitem stable "Stable" "Stable List" 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 * 98 * This macro is unnecessary since ICU 49 requires namespace support. 99 * You can just use "icu::" instead. 100 * \xrefitem stable "Stable" "Stable List" ICU 2.4 101 */ 102 103 # if U_DISABLE_RENAMING 104 # define U_ICU_NAMESPACE icu 105 namespace U_ICU_NAMESPACE { } 106 # else 107 # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) 108 namespace U_ICU_NAMESPACE { } 109 namespace icu = U_ICU_NAMESPACE; 110 # endif 111 112 # define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { 113 # define U_NAMESPACE_END } 114 # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; 115 # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: 116 117 # ifndef U_USING_ICU_NAMESPACE 118 # if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ 119 defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ 120 defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) 121 # define U_USING_ICU_NAMESPACE 0 122 # else 123 # define U_USING_ICU_NAMESPACE 0 124 # endif 125 # endif 126 # if U_USING_ICU_NAMESPACE 127 U_NAMESPACE_USE 128 # endif 129 130 #ifndef U_HIDE_DRAFT_API 131 /** 132 * \def U_HEADER_NESTED_NAMESPACE 133 * Nested namespace used inside U_ICU_NAMESPACE for header-only APIs. 134 * Different when used inside ICU to prevent public use of internal instantiations: 135 * "header" when compiling calling code; "internal" when compiling ICU library code. 136 * 137 * When compiling for Windows, where DLL exports of APIs are explicit, 138 * this is always "header". Header-only types are not marked for export, 139 * which on Windows already avoids callers linking with library instantiations. 140 * 141 * \xrefitem draft "Draft" "Draft List" This API may be changed in the future versions and was introduced in ICU 76 142 * @see U_HEADER_ONLY_NAMESPACE 143 */ 144 145 /** 146 * \def U_HEADER_ONLY_NAMESPACE 147 * Namespace used for header-only APIs. 148 * Different when used inside ICU to prevent public use of internal instantiations. 149 * "U_ICU_NAMESPACE::header" or "U_ICU_NAMESPACE::internal", 150 * see U_HEADER_NESTED_NAMESPACE for details. 151 * 152 * \xrefitem draft "Draft" "Draft List" This API may be changed in the future versions and was introduced in ICU 76 153 */ 154 155 // The first test is the same as for defining U_EXPORT for Windows. 156 #if defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \ 157 UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__)) 158 # define U_HEADER_NESTED_NAMESPACE header 159 #elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ 160 defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ 161 defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) 162 # define U_HEADER_NESTED_NAMESPACE internal 163 #else 164 # define U_HEADER_NESTED_NAMESPACE header 165 #endif 166 167 #define U_HEADER_ONLY_NAMESPACE U_ICU_NAMESPACE::U_HEADER_NESTED_NAMESPACE 168 169 namespace U_HEADER_ONLY_NAMESPACE {} 170 #endif // U_HIDE_DRAFT_API 171 172 #endif /* __cplusplus */ 173 174 /*===========================================================================*/ 175 /* General version helper functions. Definitions in putil.c */ 176 /*===========================================================================*/ 177 178 179 180 181 182 183 /** 184 * Write a string with dotted-decimal version information according 185 * to the input UVersionInfo. 186 * Definition of this function lives in putil.c 187 * 188 * @param versionArray The version information to be written as a string. 189 * @param versionString A string buffer that will be filled in with 190 * a string corresponding to the numeric version 191 * information in versionArray. 192 * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. 193 * \xrefitem stable "Stable" "Stable List" ICU 2.4 194 */ 195 U_CAPI void U_EXPORT2 196 u_versionToString(const UVersionInfo versionArray, char *versionString) __INTRODUCED_IN(31); 197 198 199 200 /** 201 * Gets the ICU release version. The version array stores the version information 202 * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. 203 * Definition of this function lives in putil.c 204 * 205 * @param versionArray the version # information, the result will be filled in 206 * \xrefitem stable "Stable" "Stable List" ICU 2.0 207 */ 208 U_CAPI void U_EXPORT2 209 u_getVersion(UVersionInfo versionArray) __INTRODUCED_IN(31); 210 211 212 #endif 213 214 /** @} */ // addtogroup 215