Path: blob/jdk8u272-b10-aarch32-20201026/jdk/src/share/native/common/unicode/locdspnm.h
48751 views
// © 2016 and later: Unicode, Inc. and others.1// License & terms of use: http://www.unicode.org/copyright.html2/*3******************************************************************************4* Copyright (C) 2010-2016, International Business Machines Corporation and5* others. All Rights Reserved.6******************************************************************************7*/89#ifndef LOCDSPNM_H10#define LOCDSPNM_H1112#include "unicode/utypes.h"1314/**15* \file16* \brief C++ API: Provides display names of Locale and its components.17*/1819#if !UCONFIG_NO_FORMATTING2021#include "unicode/locid.h"22#include "unicode/strenum.h"23#include "unicode/uscript.h"24#include "unicode/uldnames.h"25#include "unicode/udisplaycontext.h"2627U_NAMESPACE_BEGIN2829/**30* Returns display names of Locales and components of Locales. For31* more information on language, script, region, variant, key, and32* values, see Locale.33* @stable ICU 4.434*/35class U_COMMON_API LocaleDisplayNames : public UObject {36public:37/**38* Destructor.39* @stable ICU 4.440*/41virtual ~LocaleDisplayNames();4243/**44* Convenience overload of45* {@link #createInstance(const Locale& locale, UDialectHandling dialectHandling)}46* that specifies STANDARD dialect handling.47* @param locale the display locale48* @return a LocaleDisplayNames instance49* @stable ICU 4.450*/51inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);5253/**54* Returns an instance of LocaleDisplayNames that returns names55* formatted for the provided locale, using the provided56* dialectHandling.57*58* @param locale the display locale59* @param dialectHandling how to select names for locales60* @return a LocaleDisplayNames instance61* @stable ICU 4.462*/63static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,64UDialectHandling dialectHandling);6566/**67* Returns an instance of LocaleDisplayNames that returns names formatted68* for the provided locale, using the provided UDisplayContext settings.69*70* @param locale the display locale71* @param contexts List of one or more context settings (e.g. for dialect72* handling, capitalization, etc.73* @param length Number of items in the contexts list74* @return a LocaleDisplayNames instance75* @stable ICU 5176*/77static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,78UDisplayContext *contexts, int32_t length);7980// getters for state81/**82* Returns the locale used to determine the display names. This is83* not necessarily the same locale passed to {@link #createInstance}.84* @return the display locale85* @stable ICU 4.486*/87virtual const Locale& getLocale() const = 0;8889/**90* Returns the dialect handling used in the display names.91* @return the dialect handling enum92* @stable ICU 4.493*/94virtual UDialectHandling getDialectHandling() const = 0;9596/**97* Returns the UDisplayContext value for the specified UDisplayContextType.98* @param type the UDisplayContextType whose value to return99* @return the UDisplayContext for the specified type.100* @stable ICU 51101*/102virtual UDisplayContext getContext(UDisplayContextType type) const = 0;103104// names for entire locales105/**106* Returns the display name of the provided locale.107* @param locale the locale whose display name to return108* @param result receives the locale's display name109* @return the display name of the provided locale110* @stable ICU 4.4111*/112virtual UnicodeString& localeDisplayName(const Locale& locale,113UnicodeString& result) const = 0;114115/**116* Returns the display name of the provided locale id.117* @param localeId the id of the locale whose display name to return118* @param result receives the locale's display name119* @return the display name of the provided locale120* @stable ICU 4.4121*/122virtual UnicodeString& localeDisplayName(const char* localeId,123UnicodeString& result) const = 0;124125// names for components of a locale id126/**127* Returns the display name of the provided language code.128* @param lang the language code129* @param result receives the language code's display name130* @return the display name of the provided language code131* @stable ICU 4.4132*/133virtual UnicodeString& languageDisplayName(const char* lang,134UnicodeString& result) const = 0;135136/**137* Returns the display name of the provided script code.138* @param script the script code139* @param result receives the script code's display name140* @return the display name of the provided script code141* @stable ICU 4.4142*/143virtual UnicodeString& scriptDisplayName(const char* script,144UnicodeString& result) const = 0;145146/**147* Returns the display name of the provided script code.148* @param scriptCode the script code number149* @param result receives the script code's display name150* @return the display name of the provided script code151* @stable ICU 4.4152*/153virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,154UnicodeString& result) const = 0;155156/**157* Returns the display name of the provided region code.158* @param region the region code159* @param result receives the region code's display name160* @return the display name of the provided region code161* @stable ICU 4.4162*/163virtual UnicodeString& regionDisplayName(const char* region,164UnicodeString& result) const = 0;165166/**167* Returns the display name of the provided variant.168* @param variant the variant string169* @param result receives the variant's display name170* @return the display name of the provided variant171* @stable ICU 4.4172*/173virtual UnicodeString& variantDisplayName(const char* variant,174UnicodeString& result) const = 0;175176/**177* Returns the display name of the provided locale key.178* @param key the locale key name179* @param result receives the locale key's display name180* @return the display name of the provided locale key181* @stable ICU 4.4182*/183virtual UnicodeString& keyDisplayName(const char* key,184UnicodeString& result) const = 0;185186/**187* Returns the display name of the provided value (used with the provided key).188* @param key the locale key name189* @param value the locale key's value190* @param result receives the value's display name191* @return the display name of the provided value192* @stable ICU 4.4193*/194virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,195UnicodeString& result) const = 0;196};197198inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {199return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);200}201202U_NAMESPACE_END203204#endif205206#endif207208209