ICU 75.1 75.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
icu::LocaleDisplayNames::~LocaleDisplayNames
virtual ~LocaleDisplayNames()
Destructor.
icu::LocaleDisplayNames::localeDisplayName
virtual UnicodeString & localeDisplayName(const char *localeId, UnicodeString &result) const =0
Returns the display name of the provided locale id.
icu::LocaleDisplayNames::languageDisplayName
virtual UnicodeString & languageDisplayName(const char *lang, UnicodeString &result) const =0
Returns the display name of the provided language code.
icu::LocaleDisplayNames::keyDisplayName
virtual UnicodeString & keyDisplayName(const char *key, UnicodeString &result) const =0
Returns the display name of the provided locale key.
icu::LocaleDisplayNames::regionDisplayName
virtual UnicodeString & regionDisplayName(const char *region, UnicodeString &result) const =0
Returns the display name of the provided region code.
icu::LocaleDisplayNames::createInstance
static LocaleDisplayNames * createInstance(const Locale &locale, UDisplayContext *contexts, int32_t length)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
icu::LocaleDisplayNames::localeDisplayName
virtual UnicodeString & localeDisplayName(const Locale &locale, UnicodeString &result) const =0
Returns the display name of the provided locale.
icu::LocaleDisplayNames::keyValueDisplayName
virtual UnicodeString & keyValueDisplayName(const char *key, const char *value, UnicodeString &result) const =0
Returns the display name of the provided value (used with the provided key).
icu::LocaleDisplayNames::variantDisplayName
virtual UnicodeString & variantDisplayName(const char *variant, UnicodeString &result) const =0
Returns the display name of the provided variant.
icu::LocaleDisplayNames::getContext
virtual UDisplayContext getContext(UDisplayContextType type) const =0
Returns the UDisplayContext value for the specified UDisplayContextType.
icu::LocaleDisplayNames::scriptDisplayName
virtual UnicodeString & scriptDisplayName(UScriptCode scriptCode, UnicodeString &result) const =0
Returns the display name of the provided script code.
icu::LocaleDisplayNames::createInstance
static LocaleDisplayNames * createInstance(const Locale &locale, UDialectHandling dialectHandling)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
icu::LocaleDisplayNames::getLocale
virtual const Locale & getLocale() const =0
Returns the locale used to determine the display names.
icu::LocaleDisplayNames::getDialectHandling
virtual UDialectHandling getDialectHandling() const =0
Returns the dialect handling used in the display names.
icu::LocaleDisplayNames::scriptDisplayName
virtual UnicodeString & scriptDisplayName(const char *script, UnicodeString &result) const =0
Returns the display name of the provided script code.
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
locid.h
C++ API: Locale ID object.
strenum.h
C++ API: String Enumeration.
udisplaycontext.h
C API: Display context types (enum values)
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
uldnames.h
C API: Provides display names of Locale ids and their components.
UDialectHandling
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:30
ULDN_STANDARD_NAMES
@ ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:36
uscript.h
C API: Unicode Script Information.
UScriptCode
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:300