ICU 60.2 60.2

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

- File List
- Globals

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
20 #if !UCONFIG_NO_FORMATTING
21
22 #include "unicode/locid.h"
23 #include "unicode/strenum.h"
24 #include "unicode/uscript.h"
25 #include "unicode/uldnames.h"
26 #include "unicode/udisplaycontext.h"
27
28 U_NAMESPACE_BEGIN
29
36 class U_COMMON_API LocaleDisplayNames : public UObject {
37 public:
42 virtual ~LocaleDisplayNames();
43
52 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
53
64 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
65 UDialectHandling dialectHandling);
66
78 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
79 UDisplayContext *contexts, int32_t length);
80
81 // getters for state
88 virtual const Locale& getLocale() const = 0;
89
95 virtual UDialectHandling getDialectHandling() const = 0;
96
103 virtual UDisplayContext getContext(UDisplayContextType type) const = 0;
104
105 // names for entire locales
113 virtual UnicodeString& localeDisplayName(const Locale& locale,
114 UnicodeString& result) const = 0;
115
123 virtual UnicodeString& localeDisplayName(const char* localeId,
124 UnicodeString& result) const = 0;
125
126 // names for components of a locale id
134 virtual UnicodeString& languageDisplayName(const char* lang,
135 UnicodeString& result) const = 0;
136
144 virtual UnicodeString& scriptDisplayName(const char* script,
145 UnicodeString& result) const = 0;
146
154 virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
155 UnicodeString& result) const = 0;
156
164 virtual UnicodeString& regionDisplayName(const char* region,
165 UnicodeString& result) const = 0;
166
174 virtual UnicodeString& variantDisplayName(const char* variant,
175 UnicodeString& result) const = 0;
176
184 virtual UnicodeString& keyDisplayName(const char* key,
185 UnicodeString& result) const = 0;
186
195 virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
196 UnicodeString& result) const = 0;
197 };
198
199 inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
200 return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
201 }
202
203 U_NAMESPACE_END
204
205 #endif
206
207 #endif
icu::LocaleDisplayNames::createInstance
static LocaleDisplayNames * createInstance(const Locale &locale)
Convenience overload of createInstance(const Locale& locale, UDialectHandling dialectHandling) that s...
Definition: locdspnm.h:199
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
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
strenum.h
C++ API: String Enumeration.
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:286
icu::LocaleDisplayNames
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:36
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:188