uversion.h 7.6 KB

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