udisplaycontext.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *****************************************************************************************
  5. * Copyright (C) 2014-2016, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. *****************************************************************************************
  8. */
  9. #ifndef UDISPLAYCONTEXT_H
  10. #define UDISPLAYCONTEXT_H
  11. #include "unicode/utypes.h"
  12. #if !UCONFIG_NO_FORMATTING
  13. /**
  14. * \file
  15. * \brief C API: Display context types (enum values)
  16. */
  17. /**
  18. * Display context types, for getting values of a particular setting.
  19. * Note, the specific numeric values are internal and may change.
  20. * @stable ICU 51
  21. */
  22. enum UDisplayContextType {
  23. /**
  24. * Type to retrieve the dialect handling setting, e.g.
  25. * UDISPCTX_STANDARD_NAMES or UDISPCTX_DIALECT_NAMES.
  26. * @stable ICU 51
  27. */
  28. UDISPCTX_TYPE_DIALECT_HANDLING = 0,
  29. /**
  30. * Type to retrieve the capitalization context setting, e.g.
  31. * UDISPCTX_CAPITALIZATION_NONE, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE,
  32. * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, etc.
  33. * @stable ICU 51
  34. */
  35. UDISPCTX_TYPE_CAPITALIZATION = 1,
  36. /**
  37. * Type to retrieve the display length setting, e.g.
  38. * UDISPCTX_LENGTH_FULL, UDISPCTX_LENGTH_SHORT.
  39. * @stable ICU 54
  40. */
  41. UDISPCTX_TYPE_DISPLAY_LENGTH = 2,
  42. /**
  43. * Type to retrieve the substitute handling setting, e.g.
  44. * UDISPCTX_SUBSTITUTE, UDISPCTX_NO_SUBSTITUTE.
  45. * @stable ICU 58
  46. */
  47. UDISPCTX_TYPE_SUBSTITUTE_HANDLING = 3
  48. };
  49. /**
  50. * @stable ICU 51
  51. */
  52. typedef enum UDisplayContextType UDisplayContextType;
  53. /**
  54. * Display context settings.
  55. * Note, the specific numeric values are internal and may change.
  56. * @stable ICU 51
  57. */
  58. enum UDisplayContext {
  59. /**
  60. * ================================
  61. * DIALECT_HANDLING can be set to one of UDISPCTX_STANDARD_NAMES or
  62. * UDISPCTX_DIALECT_NAMES. Use UDisplayContextType UDISPCTX_TYPE_DIALECT_HANDLING
  63. * to get the value.
  64. */
  65. /**
  66. * A possible setting for DIALECT_HANDLING:
  67. * use standard names when generating a locale name,
  68. * e.g. en_GB displays as 'English (United Kingdom)'.
  69. * @stable ICU 51
  70. */
  71. UDISPCTX_STANDARD_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 0,
  72. /**
  73. * A possible setting for DIALECT_HANDLING:
  74. * use dialect names, when generating a locale name,
  75. * e.g. en_GB displays as 'British English'.
  76. * @stable ICU 51
  77. */
  78. UDISPCTX_DIALECT_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 1,
  79. /**
  80. * ================================
  81. * CAPITALIZATION can be set to one of UDISPCTX_CAPITALIZATION_NONE,
  82. * UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE,
  83. * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE,
  84. * UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, or
  85. * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
  86. * Use UDisplayContextType UDISPCTX_TYPE_CAPITALIZATION to get the value.
  87. */
  88. /**
  89. * The capitalization context to be used is unknown (this is the default value).
  90. * @stable ICU 51
  91. */
  92. UDISPCTX_CAPITALIZATION_NONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 0,
  93. /**
  94. * The capitalization context if a date, date symbol or display name is to be
  95. * formatted with capitalization appropriate for the middle of a sentence.
  96. * @stable ICU 51
  97. */
  98. UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 1,
  99. /**
  100. * The capitalization context if a date, date symbol or display name is to be
  101. * formatted with capitalization appropriate for the beginning of a sentence.
  102. * @stable ICU 51
  103. */
  104. UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 2,
  105. /**
  106. * The capitalization context if a date, date symbol or display name is to be
  107. * formatted with capitalization appropriate for a user-interface list or menu item.
  108. * @stable ICU 51
  109. */
  110. UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 3,
  111. /**
  112. * The capitalization context if a date, date symbol or display name is to be
  113. * formatted with capitalization appropriate for stand-alone usage such as an
  114. * isolated name on a calendar page.
  115. * @stable ICU 51
  116. */
  117. UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4,
  118. /**
  119. * ================================
  120. * DISPLAY_LENGTH can be set to one of UDISPCTX_LENGTH_FULL or
  121. * UDISPCTX_LENGTH_SHORT. Use UDisplayContextType UDISPCTX_TYPE_DISPLAY_LENGTH
  122. * to get the value.
  123. */
  124. /**
  125. * A possible setting for DISPLAY_LENGTH:
  126. * use full names when generating a locale name,
  127. * e.g. "United States" for US.
  128. * @stable ICU 54
  129. */
  130. UDISPCTX_LENGTH_FULL = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 0,
  131. /**
  132. * A possible setting for DISPLAY_LENGTH:
  133. * use short names when generating a locale name,
  134. * e.g. "U.S." for US.
  135. * @stable ICU 54
  136. */
  137. UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1,
  138. /**
  139. * ================================
  140. * SUBSTITUTE_HANDLING can be set to one of UDISPCTX_SUBSTITUTE or
  141. * UDISPCTX_NO_SUBSTITUTE. Use UDisplayContextType UDISPCTX_TYPE_SUBSTITUTE_HANDLING
  142. * to get the value.
  143. */
  144. /**
  145. * A possible setting for SUBSTITUTE_HANDLING:
  146. * Returns a fallback value (e.g., the input code) when no data is available.
  147. * This is the default value.
  148. * @stable ICU 58
  149. */
  150. UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0,
  151. /**
  152. * A possible setting for SUBSTITUTE_HANDLING:
  153. * Returns a null value with error code set to U_ILLEGAL_ARGUMENT_ERROR when no
  154. * data is available.
  155. * @stable ICU 58
  156. */
  157. UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1
  158. };
  159. /**
  160. * @stable ICU 51
  161. */
  162. typedef enum UDisplayContext UDisplayContext;
  163. #endif /* #if !UCONFIG_NO_FORMATTING */
  164. #endif