ICU 70.1  70.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"
29 
30 U_NAMESPACE_BEGIN
31 
39 public:
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 
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 
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
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:38
virtual ~LocaleDisplayNames()
Destructor.
virtual UnicodeString & localeDisplayName(const char *localeId, UnicodeString &result) const =0
Returns the display name of the provided locale id.
virtual UnicodeString & languageDisplayName(const char *lang, UnicodeString &result) const =0
Returns the display name of the provided language code.
virtual UnicodeString & keyDisplayName(const char *key, UnicodeString &result) const =0
Returns the display name of the provided locale key.
virtual UnicodeString & regionDisplayName(const char *region, UnicodeString &result) const =0
Returns the display name of the provided region 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 UnicodeString & localeDisplayName(const Locale &locale, UnicodeString &result) const =0
Returns the display name of the provided locale.
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).
virtual UnicodeString & variantDisplayName(const char *variant, UnicodeString &result) const =0
Returns the display name of the provided variant.
virtual UDisplayContext getContext(UDisplayContextType type) const =0
Returns the UDisplayContext value for the specified UDisplayContextType.
virtual UnicodeString & scriptDisplayName(UScriptCode scriptCode, UnicodeString &result) const =0
Returns the display name of the provided script code.
static LocaleDisplayNames * createInstance(const Locale &locale, UDialectHandling dialectHandling)
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 UDialectHandling getDialectHandling() const =0
Returns the dialect handling used in the display names.
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:195
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
C++ API: Locale ID object.
C++ API: String Enumeration.
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:30
@ ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:36
C API: Unicode Script Information.
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
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:300