ICU 57.1  57.1
locdspnm.h
Go to the documentation of this file.
1 /*
2 ******************************************************************************
3 * Copyright (C) 2010-2016, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ******************************************************************************
6 */
7 
8 #ifndef LOCDSPNM_H
9 #define LOCDSPNM_H
10 
11 #include "unicode/utypes.h"
12 
18 #if !UCONFIG_NO_FORMATTING
19 
20 #include "unicode/locid.h"
21 #include "unicode/uscript.h"
22 #include "unicode/uldnames.h"
24 
26 
34 public:
40 
49  static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
50 
61  static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
62  UDialectHandling dialectHandling);
63 
75  static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
76  UDisplayContext *contexts, int32_t length);
77 
78  // getters for state
85  virtual const Locale& getLocale() const = 0;
86 
92  virtual UDialectHandling getDialectHandling() const = 0;
93 
101 
102  // names for entire locales
110  virtual UnicodeString& localeDisplayName(const Locale& locale,
111  UnicodeString& result) const = 0;
112 
120  virtual UnicodeString& localeDisplayName(const char* localeId,
121  UnicodeString& result) const = 0;
122 
123  // names for components of a locale id
131  virtual UnicodeString& languageDisplayName(const char* lang,
132  UnicodeString& result) const = 0;
133 
141  virtual UnicodeString& scriptDisplayName(const char* script,
142  UnicodeString& result) const = 0;
143 
152  UnicodeString& result) const = 0;
153 
161  virtual UnicodeString& regionDisplayName(const char* region,
162  UnicodeString& result) const = 0;
163 
171  virtual UnicodeString& variantDisplayName(const char* variant,
172  UnicodeString& result) const = 0;
173 
181  virtual UnicodeString& keyDisplayName(const char* key,
182  UnicodeString& result) const = 0;
183 
192  virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
193  UnicodeString& result) const = 0;
194 };
195 
198 }
199 
201 
202 #endif
203 
204 #endif
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:33
virtual UnicodeString & languageDisplayName(const char *lang, UnicodeString &result) const =0
Returns the display name of the provided language code.
static LocaleDisplayNames * createInstance(const Locale &locale, UDisplayContext *contexts, int32_t length)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
virtual const Locale & getLocale() const =0
Returns the locale used to determine the display names.
virtual UnicodeString & keyDisplayName(const char *key, UnicodeString &result) const =0
Returns the display name of the provided locale key.
virtual UnicodeString & localeDisplayName(const Locale &locale, UnicodeString &result) const =0
Returns the display name of the provided locale.
virtual UnicodeString & localeDisplayName(const char *localeId, UnicodeString &result) const =0
Returns the display name of the provided locale id.
virtual UnicodeString & variantDisplayName(const char *variant, UnicodeString &result) const =0
Returns the display name of the provided variant.
virtual UnicodeString & regionDisplayName(const char *region, UnicodeString &result) const =0
Returns the display name of the provided region code.
virtual UnicodeString & scriptDisplayName(UScriptCode scriptCode, UnicodeString &result) const =0
Returns the display name of the provided script code.
virtual UDialectHandling getDialectHandling() const =0
Returns the dialect handling used in the display names.
virtual ~LocaleDisplayNames()
Destructor.
static LocaleDisplayNames * createInstance(const Locale &locale)
Convenience overload of createInstance(const Locale& locale, UDialectHandling dialectHandling) that s...
Definition: locdspnm.h:196
virtual UDisplayContext getContext(UDisplayContextType type) const =0
Returns the UDisplayContext value for the specified UDisplayContextType.
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).
static LocaleDisplayNames * createInstance(const Locale &locale, UDialectHandling dialectHandling)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
virtual UnicodeString & scriptDisplayName(const char *script, UnicodeString &result) const =0
Returns the display name of the provided script code.
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:185
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:294
C++ API: Locale ID object.
C API: Display context types (enum values)
UDisplayContextType
Display context types, for getting values of a particular setting.
UDisplayContext
Display context settings.
C API: Provides display names of Locale ids and their components.
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:25
@ ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:31
C API: Unicode Script Information.
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:52
Basic definitions for ICU, for both C and C++ APIs.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:357
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129