locdspnm.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
* Copyright (C) 2010-2016, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
#ifndef LOCDSPNM_H
#define LOCDSPNM_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/locid.h"
#include "unicode/strenum.h"
#include "unicode/uscript.h"
#include "unicode/uldnames.h"
#include "unicode/udisplaycontext.h"
U_NAMESPACE_BEGIN
class U_COMMON_API LocaleDisplayNames : public UObject {
public:
virtual ~LocaleDisplayNames();
inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
UDialectHandling dialectHandling);
static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
UDisplayContext *contexts, int32_t length);
// getters for state
virtual const Locale& getLocale() const = 0;
virtual UDialectHandling getDialectHandling() const = 0;
virtual UDisplayContext getContext(UDisplayContextType type) const = 0;
// names for entire locales
virtual UnicodeString& localeDisplayName(const Locale& locale,
UnicodeString& result) const = 0;
virtual UnicodeString& localeDisplayName(const char* localeId,
UnicodeString& result) const = 0;
// names for components of a locale id
virtual UnicodeString& languageDisplayName(const char* lang,
UnicodeString& result) const = 0;
virtual UnicodeString& scriptDisplayName(const char* script,
UnicodeString& result) const = 0;
virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
UnicodeString& result) const = 0;
virtual UnicodeString& regionDisplayName(const char* region,
UnicodeString& result) const = 0;
virtual UnicodeString& variantDisplayName(const char* variant,
UnicodeString& result) const = 0;
virtual UnicodeString& keyDisplayName(const char* key,
UnicodeString& result) const = 0;
virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
UnicodeString& result) const = 0;
};
inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
}
U_NAMESPACE_END
#endif
#endif /* U_SHOW_CPLUSPLUS_API */
#endif
icu::LocaleDisplayNames
Returns display names of Locales and components of Locales.
Definition: locdspnm.h:38
icu::LocaleDisplayNames::~LocaleDisplayNames
virtual ~LocaleDisplayNames()
Destructor.
icu::LocaleDisplayNames::localeDisplayName
virtual UnicodeString & localeDisplayName(const char *localeId, UnicodeString &result) const =0
Returns the display name of the provided locale id.
icu::LocaleDisplayNames::languageDisplayName
virtual UnicodeString & languageDisplayName(const char *lang, UnicodeString &result) const =0
Returns the display name of the provided language code.
icu::LocaleDisplayNames::keyDisplayName
virtual UnicodeString & keyDisplayName(const char *key, UnicodeString &result) const =0
Returns the display name of the provided locale key.
icu::LocaleDisplayNames::regionDisplayName
virtual UnicodeString & regionDisplayName(const char *region, UnicodeString &result) const =0
Returns the display name of the provided region code.
icu::LocaleDisplayNames::createInstance
static LocaleDisplayNames * createInstance(const Locale &locale, UDisplayContext *contexts, int32_t length)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
icu::LocaleDisplayNames::localeDisplayName
virtual UnicodeString & localeDisplayName(const Locale &locale, UnicodeString &result) const =0
Returns the display name of the provided locale.
icu::LocaleDisplayNames::keyValueDisplayName
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).
icu::LocaleDisplayNames::variantDisplayName
virtual UnicodeString & variantDisplayName(const char *variant, UnicodeString &result) const =0
Returns the display name of the provided variant.
icu::LocaleDisplayNames::getContext
virtual UDisplayContext getContext(UDisplayContextType type) const =0
Returns the UDisplayContext value for the specified UDisplayContextType.
icu::LocaleDisplayNames::scriptDisplayName
virtual UnicodeString & scriptDisplayName(UScriptCode scriptCode, UnicodeString &result) const =0
Returns the display name of the provided script code.
icu::LocaleDisplayNames::createInstance
static LocaleDisplayNames * createInstance(const Locale &locale, UDialectHandling dialectHandling)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
icu::LocaleDisplayNames::getLocale
virtual const Locale & getLocale() const =0
Returns the locale used to determine the display names.
icu::LocaleDisplayNames::getDialectHandling
virtual UDialectHandling getDialectHandling() const =0
Returns the dialect handling used in the display names.
icu::LocaleDisplayNames::scriptDisplayName
virtual UnicodeString & scriptDisplayName(const char *script, UnicodeString &result) const =0
Returns the display name of the provided script code.
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
locid.h
C++ API: Locale ID object.
strenum.h
C++ API: String Enumeration.
udisplaycontext.h
C API: Display context types (enum values)
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
uldnames.h
C API: Provides display names of Locale ids and their components.
UDialectHandling
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:30
ULDN_STANDARD_NAMES
@ ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:36
uscript.h
C API: Unicode Script Information.
UScriptCode
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:315