uversion.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. *******************************************************************************
  3. * Copyright (C) 2000-2010, 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. * If the C++ compiler supports namespaces, it also begins a namespace block.
  60. * @stable ICU 2.4
  61. */
  62. /**
  63. * \def U_NAMESPACE_END
  64. * This is used to end a declaration of a public ICU C++ API.
  65. * When not compiling for C++, it does nothing.
  66. * When compiling for C++, it ends the extern "C++" block begun by
  67. * U_NAMESPACE_BEGIN.
  68. * If the C++ compiler supports namespaces, it also ends the namespace block
  69. * begun by U_NAMESPACE_BEGIN.
  70. * @stable ICU 2.4
  71. */
  72. /**
  73. * \def U_NAMESPACE_USE
  74. * This is used to specify that the rest of the code uses the
  75. * public ICU C++ API namespace.
  76. * If the compiler doesn't support namespaces, this does nothing.
  77. * @stable ICU 2.4
  78. */
  79. /**
  80. * \def U_NAMESPACE_QUALIFIER
  81. * This is used to qualify that a function or class is part of
  82. * the public ICU C++ API namespace.
  83. * If the compiler doesn't support namespaces, this does nothing.
  84. * @stable ICU 2.4
  85. */
  86. /* Define namespace symbols if the compiler supports it. */
  87. #ifdef XP_CPLUSPLUS
  88. #if U_HAVE_NAMESPACE
  89. # if U_DISABLE_RENAMING
  90. # define U_ICU_NAMESPACE icu
  91. namespace U_ICU_NAMESPACE { }
  92. # else
  93. # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
  94. namespace U_ICU_NAMESPACE { }
  95. namespace icu = U_ICU_NAMESPACE;
  96. # endif
  97. # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
  98. # define U_NAMESPACE_END } }
  99. # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
  100. # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
  101. # ifndef U_USING_ICU_NAMESPACE
  102. # define U_USING_ICU_NAMESPACE 1
  103. # endif
  104. # if U_USING_ICU_NAMESPACE
  105. U_NAMESPACE_USE
  106. # endif
  107. #else
  108. # define U_NAMESPACE_BEGIN extern "C++" {
  109. # define U_NAMESPACE_END }
  110. # define U_NAMESPACE_USE
  111. # define U_NAMESPACE_QUALIFIER
  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(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