ICU 50.2 50.2
locdspnm.h
Go to the documentation of this file.
1/*
2******************************************************************************
3* Copyright (C) 2010-2012, 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
17
18#if !UCONFIG_NO_FORMATTING
19
20#include "unicode/locid.h"
21#include "unicode/uscript.h"
22#include "unicode/uldnames.h"
23#include "unicode/udisplaycontext.h"
24
26
34public:
40
49 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
50
61 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
62 UDialectHandling dialectHandling);
63
64#ifndef U_HIDE_INTERNAL_API
76 static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
77 UDisplayContext *contexts, int32_t length);
78#endif /* U_HIDE_INTERNAL_API */
79
80 // getters for state
87 virtual const Locale& getLocale() const = 0;
88
95
102 virtual UDisplayContext getContext(UDisplayContextType type) const = 0;
103
104 // names for entire locales
112 virtual UnicodeString& localeDisplayName(const Locale& locale,
113 UnicodeString& result) const = 0;
114
122 virtual UnicodeString& localeDisplayName(const char* localeId,
123 UnicodeString& result) const = 0;
124
125 // names for components of a locale id
133 virtual UnicodeString& languageDisplayName(const char* lang,
134 UnicodeString& result) const = 0;
135
143 virtual UnicodeString& scriptDisplayName(const char* script,
144 UnicodeString& result) const = 0;
145
154 UnicodeString& result) const = 0;
155
163 virtual UnicodeString& regionDisplayName(const char* region,
164 UnicodeString& result) const = 0;
165
173 virtual UnicodeString& variantDisplayName(const char* variant,
174 UnicodeString& result) const = 0;
175
183 virtual UnicodeString& keyDisplayName(const char* key,
184 UnicodeString& result) const = 0;
185
194 virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
195 UnicodeString& result) const = 0;
196
197private:
198 // No ICU "poor man's RTTI" for this class nor its subclasses.
199 virtual UClassID getDynamicClassID() const;
200};
201
205
207
208#endif
209
210#endif
Returns display names of Locales and components of Locales.
Definition locdspnm.h:33
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.
static LocaleDisplayNames * createInstance(const Locale &locale, UDialectHandling dialectHandling)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
virtual UnicodeString & variantDisplayName(const char *variant, UnicodeString &result) const =0
Returns the display name of the provided variant.
virtual UnicodeString & scriptDisplayName(UScriptCode scriptCode, UnicodeString &result) const =0
Returns the display name of the provided script 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 char *localeId, UnicodeString &result) const =0
Returns the display name of the provided locale id.
virtual UDialectHandling getDialectHandling() const =0
Returns the dialect handling used in the display names.
virtual const Locale & getLocale() const =0
Returns the locale used to determine the display names.
virtual UnicodeString & regionDisplayName(const char *region, UnicodeString &result) const =0
Returns the display name of the provided region code.
virtual ~LocaleDisplayNames()
Destructor.
static LocaleDisplayNames * createInstance(const Locale &locale)
Convenience overload of createInstance(const Locale& locale, UDialectHandling dialectHandling) that s...
Definition locdspnm.h:202
virtual UnicodeString & scriptDisplayName(const char *script, UnicodeString &result) const =0
Returns the display name of the provided script code.
virtual UnicodeString & languageDisplayName(const char *lang, UnicodeString &result) const =0
Returns the display name of the provided language code.
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).
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:182
UObject is the common ICU "boilerplate" class.
Definition uobject.h:229
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:247
C++ API: Locale ID object.
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
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:96
C API: Unicode Script Information.
UScriptCode
Constants for ISO 15924 script codes.
Definition uscript.h:46
Basic definitions for ICU, for both C and C++ APIs.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:358
#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