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