ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

locdspnm.h
Go to the documentation of this file.
1 // Copyright (C) 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
20 #if !UCONFIG_NO_FORMATTING
21
22 #include "unicode/locid.h"
23 #include "unicode/uscript.h"
24 #include "unicode/uldnames.h"
25 #include "unicode/udisplaycontext.h"
26
27 U_NAMESPACE_BEGIN
28
35 class U_COMMON_API LocaleDisplayNames : public UObject {
36 public:
41 virtual ~LocaleDisplayNames();
42
51 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
52
63 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
64 UDialectHandling dialectHandling);
65
77 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
78 UDisplayContext *contexts, int32_t length);
79
80 // getters for state
87 virtual const Locale& getLocale() const = 0;
88
94 virtual UDialectHandling getDialectHandling() const = 0;
95
102 virtual UDisplayContext getContext(UDisplayContextType type) const = 0;
103
104 // names for entire locales
112 virtual UnicodeString& localeDisplayName(const Locale& locale,
113 UnicodeString& result) const = 0;
114
122 virtual UnicodeString& localeDisplayName(const char* localeId,
123 UnicodeString& result) const = 0;
124
125 // names for components of a locale id
133 virtual UnicodeString& languageDisplayName(const char* lang,
134 UnicodeString& result) const = 0;
135
143 virtual UnicodeString& scriptDisplayName(const char* script,
144 UnicodeString& result) const = 0;
145
153 virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
154 UnicodeString& result) const = 0;
155
163 virtual UnicodeString& regionDisplayName(const char* region,
164 UnicodeString& result) const = 0;
165
173 virtual UnicodeString& variantDisplayName(const char* variant,
174 UnicodeString& result) const = 0;
175
183 virtual UnicodeString& keyDisplayName(const char* key,
184 UnicodeString& result) const = 0;
185
194 virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
195 UnicodeString& result) const = 0;
196 };
197
198 inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
199 return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
200 }
201
202 U_NAMESPACE_END
203
204 #endif
205
206 #endif
icu::LocaleDisplayNames::createInstance
static LocaleDisplayNames * createInstance(const Locale &locale)
Convenience overload of createInstance(const Locale& locale, UDialectHandling dialectHandling) that s...
Definition: locdspnm.h:198
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:66
UScriptCode
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
udisplaycontext.h
C API: Display context types (enum values)
uscript.h
C API: Unicode Script Information.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:33
UDialectHandling
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:27
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
locid.h
C++ API: Locale ID object.
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:359
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::LocaleDisplayNames
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:35
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
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:187