uversion.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. #endif /* __cplusplus */
  110. /*===========================================================================*/
  111. /* General version helper functions. Definitions in putil.c */
  112. /*===========================================================================*/
  113. /**
  114. * Parse a string with dotted-decimal version information and
  115. * fill in a UVersionInfo structure with the result.
  116. * Definition of this function lives in putil.c
  117. *
  118. * @param versionArray The destination structure for the version information.
  119. * @param versionString A string with dotted-decimal version information,
  120. * with up to four non-negative number fields with
  121. * values of up to 255 each.
  122. * @stable ICU 2.4
  123. */
  124. U_CAPI void U_EXPORT2
  125. u_versionFromString(UVersionInfo versionArray, const char *versionString);
  126. /**
  127. * Parse a Unicode string with dotted-decimal version information and
  128. * fill in a UVersionInfo structure with the result.
  129. * Definition of this function lives in putil.c
  130. *
  131. * @param versionArray The destination structure for the version information.
  132. * @param versionString A Unicode string with dotted-decimal version
  133. * information, with up to four non-negative number
  134. * fields with values of up to 255 each.
  135. * @stable ICU 4.2
  136. */
  137. U_CAPI void U_EXPORT2
  138. u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
  139. /**
  140. * Write a string with dotted-decimal version information according
  141. * to the input UVersionInfo.
  142. * Definition of this function lives in putil.c
  143. *
  144. * @param versionArray The version information to be written as a string.
  145. * @param versionString A string buffer that will be filled in with
  146. * a string corresponding to the numeric version
  147. * information in versionArray.
  148. * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
  149. * @stable ICU 2.4
  150. */
  151. U_CAPI void U_EXPORT2
  152. u_versionToString(const UVersionInfo versionArray, char *versionString);
  153. /**
  154. * Gets the ICU release version. The version array stores the version information
  155. * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02.
  156. * Definition of this function lives in putil.c
  157. *
  158. * @param versionArray the version # information, the result will be filled in
  159. * @stable ICU 2.0
  160. */
  161. U_CAPI void U_EXPORT2
  162. u_getVersion(UVersionInfo versionArray);
  163. #endif