Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/unicode/locdspnm.h
38827 views
/*1******************************************************************************2* Copyright (C) 2010-2016, International Business Machines Corporation and3* others. All Rights Reserved.4******************************************************************************5*/67#ifndef LOCDSPNM_H8#define LOCDSPNM_H910#include "unicode/utypes.h"1112/**13* \file14* \brief C++ API: Provides display names of Locale and its components.15*/1617#if !UCONFIG_NO_FORMATTING1819#include "unicode/locid.h"20#include "unicode/uscript.h"21#include "unicode/uldnames.h"22#include "unicode/udisplaycontext.h"2324U_NAMESPACE_BEGIN2526/**27* Returns display names of Locales and components of Locales. For28* more information on language, script, region, variant, key, and29* values, see Locale.30* @stable ICU 4.431*/32class U_COMMON_API LocaleDisplayNames : public UObject {33public:34/**35* Destructor.36* @stable ICU 4.437*/38virtual ~LocaleDisplayNames();3940/**41* Convenience overload of42* {@link #createInstance(const Locale& locale, UDialectHandling dialectHandling)}43* that specifies STANDARD dialect handling.44* @param locale the display locale45* @return a LocaleDisplayNames instance46* @stable ICU 4.447*/48static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);4950/**51* Returns an instance of LocaleDisplayNames that returns names52* formatted for the provided locale, using the provided53* dialectHandling.54*55* @param locale the display locale56* @param dialectHandling how to select names for locales57* @return a LocaleDisplayNames instance58* @stable ICU 4.459*/60static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,61UDialectHandling dialectHandling);6263/**64* Returns an instance of LocaleDisplayNames that returns names formatted65* for the provided locale, using the provided UDisplayContext settings.66*67* @param locale the display locale68* @param contexts List of one or more context settings (e.g. for dialect69* handling, capitalization, etc.70* @param length Number of items in the contexts list71* @return a LocaleDisplayNames instance72* @stable ICU 5173*/74static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,75UDisplayContext *contexts, int32_t length);7677// getters for state78/**79* Returns the locale used to determine the display names. This is80* not necessarily the same locale passed to {@link #createInstance}.81* @return the display locale82* @stable ICU 4.483*/84virtual const Locale& getLocale() const = 0;8586/**87* Returns the dialect handling used in the display names.88* @return the dialect handling enum89* @stable ICU 4.490*/91virtual UDialectHandling getDialectHandling() const = 0;9293/**94* Returns the UDisplayContext value for the specified UDisplayContextType.95* @param type the UDisplayContextType whose value to return96* @return the UDisplayContext for the specified type.97* @stable ICU 5198*/99virtual UDisplayContext getContext(UDisplayContextType type) const = 0;100101// names for entire locales102/**103* Returns the display name of the provided locale.104* @param locale the locale whose display name to return105* @param result receives the locale's display name106* @return the display name of the provided locale107* @stable ICU 4.4108*/109virtual UnicodeString& localeDisplayName(const Locale& locale,110UnicodeString& result) const = 0;111112/**113* Returns the display name of the provided locale id.114* @param localeId the id of the locale whose display name to return115* @param result receives the locale's display name116* @return the display name of the provided locale117* @stable ICU 4.4118*/119virtual UnicodeString& localeDisplayName(const char* localeId,120UnicodeString& result) const = 0;121122// names for components of a locale id123/**124* Returns the display name of the provided language code.125* @param lang the language code126* @param result receives the language code's display name127* @return the display name of the provided language code128* @stable ICU 4.4129*/130virtual UnicodeString& languageDisplayName(const char* lang,131UnicodeString& result) const = 0;132133/**134* Returns the display name of the provided script code.135* @param script the script code136* @param result receives the script code's display name137* @return the display name of the provided script code138* @stable ICU 4.4139*/140virtual UnicodeString& scriptDisplayName(const char* script,141UnicodeString& result) const = 0;142143/**144* Returns the display name of the provided script code.145* @param scriptCode the script code number146* @param result receives the script code's display name147* @return the display name of the provided script code148* @stable ICU 4.4149*/150virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,151UnicodeString& result) const = 0;152153/**154* Returns the display name of the provided region code.155* @param region the region code156* @param result receives the region code's display name157* @return the display name of the provided region code158* @stable ICU 4.4159*/160virtual UnicodeString& regionDisplayName(const char* region,161UnicodeString& result) const = 0;162163/**164* Returns the display name of the provided variant.165* @param variant the variant string166* @param result receives the variant's display name167* @return the display name of the provided variant168* @stable ICU 4.4169*/170virtual UnicodeString& variantDisplayName(const char* variant,171UnicodeString& result) const = 0;172173/**174* Returns the display name of the provided locale key.175* @param key the locale key name176* @param result receives the locale key's display name177* @return the display name of the provided locale key178* @stable ICU 4.4179*/180virtual UnicodeString& keyDisplayName(const char* key,181UnicodeString& result) const = 0;182183/**184* Returns the display name of the provided value (used with the provided key).185* @param key the locale key name186* @param value the locale key's value187* @param result receives the value's display name188* @return the display name of the provided value189* @stable ICU 4.4190*/191virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,192UnicodeString& result) const = 0;193};194195inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {196return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);197}198199U_NAMESPACE_END200201#endif202203#endif204205206