/*
******************************************************************************
-* Copyright (C) 2010-2011, International Business Machines Corporation and
+* Copyright (C) 2010-2012, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
#include "unicode/locid.h"
#include "unicode/uscript.h"
#include "unicode/uldnames.h"
+#include "unicode/udisplaycontext.h"
U_NAMESPACE_BEGIN
* @stable ICU 4.4
*/
static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
- UDialectHandling dialectHandling);
+ UDialectHandling dialectHandling);
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns an instance of LocaleDisplayNames that returns names formatted
+ * for the provided locale, using the provided UDisplayContext settings.
+ *
+ * @param locale the display locale
+ * @param contexts List of one or more context settings (e.g. for dialect
+ * handling, capitalization, etc.
+ * @param length Number of items in the contexts list
+ * @return a LocaleDisplayNames instance
+ * @draft ICU 51
+ */
+ static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
+ UDisplayContext *contexts, int32_t length);
+#endif /* U_HIDE_DRAFT_API */
// getters for state
/**
*/
virtual UDialectHandling getDialectHandling() const = 0;
+ /**
+ * Returns the UDisplayContext value for the specified UDisplayContextType.
+ * @param type the UDisplayContextType whose value to return
+ * @return the UDisplayContext for the specified type.
+ * @draft ICU 51
+ */
+ virtual UDisplayContext getContext(UDisplayContextType type) const = 0;
+
// names for entire locales
/**
* Returns the display name of the provided locale.
* @stable ICU 4.4
*/
virtual UnicodeString& localeDisplayName(const Locale& locale,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided locale id.
* @stable ICU 4.4
*/
virtual UnicodeString& localeDisplayName(const char* localeId,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
// names for components of a locale id
/**
* @stable ICU 4.4
*/
virtual UnicodeString& languageDisplayName(const char* lang,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided script code.
* @stable ICU 4.4
*/
virtual UnicodeString& scriptDisplayName(const char* script,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided script code.
* @stable ICU 4.4
*/
virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided region code.
* @stable ICU 4.4
*/
virtual UnicodeString& regionDisplayName(const char* region,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided variant.
* @stable ICU 4.4
*/
virtual UnicodeString& variantDisplayName(const char* variant,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided locale key.
* @stable ICU 4.4
*/
virtual UnicodeString& keyDisplayName(const char* key,
- UnicodeString& result) const = 0;
+ UnicodeString& result) const = 0;
/**
* Returns the display name of the provided value (used with the provided key).
* @stable ICU 4.4
*/
virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
- UnicodeString& result) const = 0;
-
-private:
- // No ICU "poor man's RTTI" for this class nor its subclasses.
- virtual UClassID getDynamicClassID() const;
+ UnicodeString& result) const = 0;
};
inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {