ICU 65.1  65.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:
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 
203 }
204 
205 U_NAMESPACE_END
206 
207 #endif
208 
209 #endif /* U_SHOW_CPLUSPLUS_API */
210 
211 #endif
static LocaleDisplayNames * createInstance(const Locale &locale)
Convenience overload of createInstance(const Locale& locale, UDialectHandling dialectHandling) that s...
Definition: locdspnm.h:201
UDisplayContext
Display context settings.
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
C API: Display context types (enum values)
C API: Unicode Script Information.
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:33
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:27
UDisplayContextType
Display context types, for getting values of a particular setting.
C++ API: String Enumeration.
C++ API: Locale ID object.
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
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:294
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:38
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
C API: Provides display names of Locale ids and their components.
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195