ICU 71.1 71.1

locdspnm.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 * Copyright (C) 2010-2016, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ******************************************************************************
8 */
9
10 #ifndef LOCDSPNM_H
11 #define LOCDSPNM_H
12
13 #include "unicode/utypes.h"
14
15 #if U_SHOW_CPLUSPLUS_API
16
22 #if !UCONFIG_NO_FORMATTING
23
24 #include "unicode/locid.h"
25 #include "unicode/strenum.h"
26 #include "unicode/uscript.h"
27 #include "unicode/uldnames.h"
28 #include "unicode/udisplaycontext.h"
29
30 U_NAMESPACE_BEGIN
31
38 class U_COMMON_API LocaleDisplayNames : public UObject {
39 public:
44 virtual ~LocaleDisplayNames();
45
54 inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
55
66 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
67 UDialectHandling dialectHandling);
68
80 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
81 UDisplayContext *contexts, int32_t length);
82
83 // getters for state
90 virtual const Locale& getLocale() const = 0;
91
97 virtual UDialectHandling getDialectHandling() const = 0;
98
105 virtual UDisplayContext getContext(UDisplayContextType type) const = 0;
106
107 // names for entire locales
115 virtual UnicodeString& localeDisplayName(const Locale& locale,
116 UnicodeString& result) const = 0;
117
125 virtual UnicodeString& localeDisplayName(const char* localeId,
126 UnicodeString& result) const = 0;
127
128 // names for components of a locale id
136 virtual UnicodeString& languageDisplayName(const char* lang,
137 UnicodeString& result) const = 0;
138
146 virtual UnicodeString& scriptDisplayName(const char* script,
147 UnicodeString& result) const = 0;
148
156 virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
157 UnicodeString& result) const = 0;
158
166 virtual UnicodeString& regionDisplayName(const char* region,
167 UnicodeString& result) const = 0;
168
176 virtual UnicodeString& variantDisplayName(const char* variant,
177 UnicodeString& result) const = 0;
178
186 virtual UnicodeString& keyDisplayName(const char* key,
187 UnicodeString& result) const = 0;
188
197 virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
198 UnicodeString& result) const = 0;
199 };
200
201 inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
202 return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
203 }
204
205 U_NAMESPACE_END
206
207 #endif
208
209 #endif /* U_SHOW_CPLUSPLUS_API */
210
211 #endif
icu::LocaleDisplayNames
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:38
UDialectHandling
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:30
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
uscript.h
C API: Unicode Script Information.
UScriptCode
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
ULDN_STANDARD_NAMES
@ ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:36
U_COMMON_API
#define U_COMMON_API
Definition: utypes.h:300
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
strenum.h
C++ API: String Enumeration.
udisplaycontext.h
C API: Display context types (enum values)
locid.h
C++ API: Locale ID object.
uldnames.h
C API: Provides display names of Locale ids and their components.
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195