uversion.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. *******************************************************************************
  3. * Copyright (C) 2000-2011, International Business Machines
  4. * Corporation and others. All Rights Reserved.
  5. *******************************************************************************
  6. *
  7. * file name: uversion.h
  8. * encoding: US-ASCII
  9. * tab size: 8 (not used)
  10. * indentation:4
  11. *
  12. * Created by: Vladimir Weinstein
  13. *
  14. * Gets included by utypes.h and Windows .rc files
  15. */
  16. /**
  17. * \file
  18. * \brief C API: API for accessing ICU version numbers.
  19. */
  20. /*===========================================================================*/
  21. /* Main ICU version information */
  22. /*===========================================================================*/
  23. #ifndef UVERSION_H
  24. #define UVERSION_H
  25. #include "unicode/umachine.h"
  26. /* Actual version info lives in uvernum.h */
  27. #include "unicode/uvernum.h"
  28. /** Maximum length of the copyright string.
  29. * @stable ICU 2.4
  30. */
  31. #define U_COPYRIGHT_STRING_LENGTH 128
  32. /** An ICU version consists of up to 4 numbers from 0..255.
  33. * @stable ICU 2.4
  34. */
  35. #define U_MAX_VERSION_LENGTH 4
  36. /** In a string, ICU version fields are delimited by dots.
  37. * @stable ICU 2.4
  38. */
  39. #define U_VERSION_DELIMITER '.'
  40. /** The maximum length of an ICU version string.
  41. * @stable ICU 2.4
  42. */
  43. #define U_MAX_VERSION_STRING_LENGTH 20
  44. /** The binary form of a version on ICU APIs is an array of 4 uint8_t.
  45. * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
  46. * @stable ICU 2.4
  47. */
  48. typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
  49. /*===========================================================================*/
  50. /* C++ namespace if supported. Versioned unless versioning is disabled. */
  51. /*===========================================================================*/
  52. /**
  53. * \def U_NAMESPACE_BEGIN
  54. * This is used to begin a declaration of a public ICU C++ API.
  55. * When not compiling for C++, it does nothing.
  56. * When compiling for C++, it begins an extern "C++" linkage block (to protect
  57. * against cases in which an external client includes ICU header files inside
  58. * an extern "C" linkage block).
  59. *
  60. * It also begins a versioned-ICU-namespace block.
  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. * When not compiling for C++, it does nothing.
  67. * When compiling for C++, it ends the extern "C++" block begun by
  68. * U_NAMESPACE_BEGIN.
  69. *
  70. * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
  71. * @stable ICU 2.4
  72. */
  73. /**
  74. * \def U_NAMESPACE_USE
  75. * This is used to specify that the rest of the code uses the
  76. * public ICU C++ API namespace.
  77. * This is invoked by default; we recommend that you turn it off:
  78. * See the "Recommended Build Options" section of the ICU4C readme
  79. * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild)
  80. * @stable ICU 2.4
  81. */
  82. /**
  83. * \def U_NAMESPACE_QUALIFIER
  84. * This is used to qualify that a function or class is part of
  85. * the public ICU C++ API namespace.
  86. *
  87. * This macro is unnecessary since ICU 49 requires namespace support.
  88. * You can just use "icu::" instead.
  89. * @stable ICU 2.4
  90. */
  91. /* Define namespace symbols if the compiler supports it. */
  92. #ifdef __cplusplus
  93. # if U_DISABLE_RENAMING
  94. # define U_ICU_NAMESPACE icu
  95. namespace U_ICU_NAMESPACE { }
  96. # else
  97. # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
  98. namespace U_ICU_NAMESPACE { }
  99. namespace icu = U_ICU_NAMESPACE;
  100. # endif
  101. # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
  102. # define U_NAMESPACE_END } }
  103. # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
  104. # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
  105. # ifndef U_USING_ICU_NAMESPACE
  106. # define U_USING_ICU_NAMESPACE 1
  107. # endif
  108. # if U_USING_ICU_NAMESPACE
  109. U_NAMESPACE_USE
  110. # endif
  111. #else
  112. # define U_NAMESPACE_BEGIN
  113. # define U_NAMESPACE_END
  114. # define U_NAMESPACE_USE
  115. # define U_NAMESPACE_QUALIFIER
  116. #endif
  117. /*===========================================================================*/
  118. /* General version helper functions. Definitions in putil.c */
  119. /*===========================================================================*/
  120. /**
  121. * Parse a string with dotted-decimal version information and
  122. * fill in a UVersionInfo structure with the result.
  123. * Definition of this function lives in putil.c
  124. *
  125. * @param versionArray The destination structure for the version information.
  126. * @param versionString A string with dotted-decimal version information,
  127. * with up to four non-negative number fields with
  128. * values of up to 255 each.
  129. * @stable ICU 2.4
  130. */
  131. U_STABLE void U_EXPORT2
  132. u_versionFromString(UVersionInfo versionArray, const char *versionString);
  133. /**
  134. * Parse a Unicode string with dotted-decimal version information and
  135. * fill in a UVersionInfo structure with the result.
  136. * Definition of this function lives in putil.c
  137. *
  138. * @param versionArray The destination structure for the version information.
  139. * @param versionString A Unicode string with dotted-decimal version
  140. * information, with up to four non-negative number
  141. * fields with values of up to 255 each.
  142. * @stable ICU 4.2
  143. */
  144. U_STABLE void U_EXPORT2
  145. u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
  146. /**
  147. * Write a string with dotted-decimal version information according
  148. * to the input UVersionInfo.
  149. * Definition of this function lives in putil.c
  150. *
  151. * @param versionArray The version information to be written as a string.
  152. * @param versionString A string buffer that will be filled in with
  153. * a string corresponding to the numeric version
  154. * information in versionArray.
  155. * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
  156. * @stable ICU 2.4
  157. */
  158. U_STABLE void U_EXPORT2
  159. u_versionToString(const UVersionInfo versionArray, char *versionString);
  160. /**
  161. * Gets the ICU release version. The version array stores the version information
  162. * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02.
  163. * Definition of this function lives in putil.c
  164. *
  165. * @param versionArray the version # information, the result will be filled in
  166. * @stable ICU 2.0
  167. */
  168. U_STABLE void U_EXPORT2
  169. u_getVersion(UVersionInfo versionArray);
  170. #endif