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 #endif /* __cplusplus */ 130 131 /*===========================================================================*/ 132 /* General version helper functions. Definitions in putil.c */ 133 /*===========================================================================*/ 134 135 136 137 138 139 140 /** 141 * Write a string with dotted-decimal version information according 142 * to the input UVersionInfo. 143 * Definition of this function lives in putil.c 144 * 145 * @param versionArray The version information to be written as a string. 146 * @param versionString A string buffer that will be filled in with 147 * a string corresponding to the numeric version 148 * information in versionArray. 149 * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. 150 * \xrefitem stable "Stable" "Stable List" ICU 2.4 151 */ 152 U_CAPI void U_EXPORT2 153 u_versionToString(const UVersionInfo versionArray, char *versionString) __INTRODUCED_IN(31); 154 155 156 157 /** 158 * Gets the ICU release version. The version array stores the version information 159 * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. 160 * Definition of this function lives in putil.c 161 * 162 * @param versionArray the version # information, the result will be filled in 163 * \xrefitem stable "Stable" "Stable List" ICU 2.0 164 */ 165 U_CAPI void U_EXPORT2 166 u_getVersion(UVersionInfo versionArray) __INTRODUCED_IN(31); 167 168 169 #endif 170 171 /** @} */ // addtogroup 172