ICU 59.1  59.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 
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"
27 
29 
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 
201 }
202 
204 
205 #endif
206 
207 #endif
static LocaleDisplayNames * createInstance(const Locale &locale)
Convenience overload of createInstance(const Locale& locale, UDialectHandling dialectHandling) that s...
Definition: locdspnm.h:199
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.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:33
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:27
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
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:359
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:36
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:188