uversion.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. // Copyright (C) 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: US-ASCII
  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. /**
  55. * \def U_NAMESPACE_BEGIN
  56. * This is used to begin a declaration of a public ICU C++ API.
  57. * When not compiling for C++, it does nothing.
  58. * When compiling for C++, it begins an extern "C++" linkage block (to protect
  59. * against cases in which an external client includes ICU header files inside
  60. * an extern "C" linkage block).
  61. *
  62. * It also begins a versioned-ICU-namespace block.
  63. * @stable ICU 2.4
  64. */
  65. /**
  66. * \def U_NAMESPACE_END
  67. * This is used to end a declaration of a public ICU C++ API.
  68. * When not compiling for C++, it does nothing.
  69. * When compiling for C++, it ends the extern "C++" block begun by
  70. * U_NAMESPACE_BEGIN.
  71. *
  72. * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
  73. * @stable ICU 2.4
  74. */
  75. /**
  76. * \def U_NAMESPACE_USE
  77. * This is used to specify that the rest of the code uses the
  78. * public ICU C++ API namespace.
  79. * This is invoked by default; we recommend that you turn it off:
  80. * See the "Recommended Build Options" section of the ICU4C readme
  81. * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild)
  82. * @stable ICU 2.4
  83. */
  84. /**
  85. * \def U_NAMESPACE_QUALIFIER
  86. * This is used to qualify that a function or class is part of
  87. * the public ICU C++ API namespace.
  88. *
  89. * This macro is unnecessary since ICU 49 requires namespace support.
  90. * You can just use "icu::" instead.
  91. * @stable ICU 2.4
  92. */
  93. /* Define namespace symbols if the compiler supports it. */
  94. #ifdef __cplusplus
  95. # if U_DISABLE_RENAMING
  96. # define U_ICU_NAMESPACE icu
  97. namespace U_ICU_NAMESPACE { }
  98. # else
  99. # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
  100. namespace U_ICU_NAMESPACE { }
  101. namespace icu = U_ICU_NAMESPACE;
  102. # endif
  103. # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
  104. # define U_NAMESPACE_END } }
  105. # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
  106. # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
  107. # ifndef U_USING_ICU_NAMESPACE
  108. # define U_USING_ICU_NAMESPACE 1
  109. # endif
  110. # if U_USING_ICU_NAMESPACE
  111. U_NAMESPACE_USE
  112. # endif
  113. #else
  114. # define U_NAMESPACE_BEGIN
  115. # define U_NAMESPACE_END
  116. # define U_NAMESPACE_USE
  117. # define U_NAMESPACE_QUALIFIER
  118. #endif
  119. /*===========================================================================*/
  120. /* General version helper functions. Definitions in putil.c */
  121. /*===========================================================================*/
  122. /**
  123. * Parse a string with dotted-decimal version information and
  124. * fill in a UVersionInfo structure with the result.
  125. * Definition of this function lives in putil.c
  126. *
  127. * @param versionArray The destination structure for the version information.
  128. * @param versionString A string with dotted-decimal version information,
  129. * with up to four non-negative number fields with
  130. * values of up to 255 each.
  131. * @stable ICU 2.4
  132. */
  133. U_STABLE void U_EXPORT2
  134. u_versionFromString(UVersionInfo versionArray, const char *versionString);
  135. /**
  136. * Parse a Unicode string with dotted-decimal version information and
  137. * fill in a UVersionInfo structure with the result.
  138. * Definition of this function lives in putil.c
  139. *
  140. * @param versionArray The destination structure for the version information.
  141. * @param versionString A Unicode string with dotted-decimal version
  142. * information, with up to four non-negative number
  143. * fields with values of up to 255 each.
  144. * @stable ICU 4.2
  145. */
  146. U_STABLE void U_EXPORT2
  147. u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
  148. /**
  149. * Write a string with dotted-decimal version information according
  150. * to the input UVersionInfo.
  151. * Definition of this function lives in putil.c
  152. *
  153. * @param versionArray The version information to be written as a string.
  154. * @param versionString A string buffer that will be filled in with
  155. * a string corresponding to the numeric version
  156. * information in versionArray.
  157. * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
  158. * @stable ICU 2.4
  159. */
  160. U_STABLE void U_EXPORT2
  161. u_versionToString(const UVersionInfo versionArray, char *versionString);
  162. /**
  163. * Gets the ICU release version. The version array stores the version information
  164. * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02.
  165. * Definition of this function lives in putil.c
  166. *
  167. * @param versionArray the version # information, the result will be filled in
  168. * @stable ICU 2.0
  169. */
  170. U_STABLE void U_EXPORT2
  171. u_getVersion(UVersionInfo versionArray);
  172. #endif