X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..b331163bffd790ced0e88b73f44f86d49ccc48a5:/icuSources/common/unicode/locid.h
diff --git a/icuSources/common/unicode/locid.h b/icuSources/common/unicode/locid.h
index 14f52853..1ad5cb54 100644
--- a/icuSources/common/unicode/locid.h
+++ b/icuSources/common/unicode/locid.h
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
-* Copyright (C) 1996-2010, International Business Machines
+* Copyright (C) 1996-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -41,6 +41,11 @@
* \brief C++ API: Locale ID object.
*/
+U_NAMESPACE_BEGIN
+
+// Forward Declarations
+void U_CALLCONV locale_available_init(); /**< @internal */
+
/**
* A Locale
object represents a specific geographical, political,
* or cultural region. An operation that requires a Locale
to perform
@@ -177,7 +182,6 @@
* @stable ICU 2.0
* @see ResourceBundle
*/
-U_NAMESPACE_BEGIN
class U_COMMON_API Locale : public UObject {
public:
/** Useful constant for the Root locale. @stable ICU 4.4 */
@@ -321,6 +325,7 @@ public:
*/
Locale *clone() const;
+#ifndef U_HIDE_SYSTEM_API
/**
* Common methods of getting the current default Locale. Used for the
* presentation: menus, dialogs, etc. Generally set once when your applet or
@@ -352,6 +357,7 @@ public:
*/
static void U_EXPORT2 setDefault(const Locale& newLocale,
UErrorCode& success);
+#endif /* U_HIDE_SYSTEM_API */
/**
* Creates a locale which has had minimal canonicalization
@@ -415,7 +421,7 @@ public:
inline const char * getName() const;
/**
- * Returns the programmatic name of the entire locale as getName would return,
+ * Returns the programmatic name of the entire locale as getName() would return,
* but without keywords.
* @return A pointer to "name".
* @see getName
@@ -435,7 +441,7 @@ public:
StringEnumeration * createKeywords(UErrorCode &status) const;
/**
- * Get the value for a keyword.
+ * Gets the value for a keyword.
*
* @param keywordName name of the keyword for which we want the value. Case insensitive.
* @param buffer The buffer to receive the keyword value.
@@ -448,7 +454,10 @@ public:
int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const;
/**
- * Set the value for a keyword.
+ * Sets or removes the value for a keyword.
+ *
+ * For removing all keywords, use getBaseName(),
+ * and construct a new Locale if it differs from getName().
*
* @param keywordName name of the keyword to be set. Case insensitive.
* @param keywordValue value of the keyword to be set. If 0-length or
@@ -456,21 +465,21 @@ public:
* that keyword does not exist.
* @param status Returns any error information while performing this operation.
*
- * @internal
+ * @stable ICU 49
*/
void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status);
/**
* returns the locale's three-letter language code, as specified
* in ISO draft standard ISO-639-2.
- * @return An alias to the code, or NULL
+ * @return An alias to the code, or an empty string
* @stable ICU 2.0
*/
const char * getISO3Language() const;
/**
* Fills in "name" with the locale's three-letter ISO-3166 country code.
- * @return An alias to the code, or NULL
+ * @return An alias to the code, or an empty string
* @stable ICU 2.0
*/
const char * getISO3Country() const;
@@ -484,6 +493,23 @@ public:
*/
uint32_t getLCID(void) const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns whether this locale's script is written right-to-left.
+ * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags().
+ * If no likely script is known, then FALSE is returned.
+ *
+ * A script is right-to-left according to the CLDR script metadata
+ * which corresponds to whether the script's letters have Bidi_Class=R or AL.
+ *
+ * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl".
+ *
+ * @return TRUE if the locale's script is written right-to-left
+ * @draft ICU 54
+ */
+ UBool isRightToLeft() const;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Fills in "dispLang" with the name of this locale's language in a format suitable for
* user display in the default locale. For example, if the locale's language code is
@@ -683,11 +709,13 @@ public:
virtual UClassID getDynamicClassID() const;
protected: /* only protected for testing purposes. DO NOT USE. */
+#ifndef U_HIDE_INTERNAL_API
/**
* Set this from a single POSIX style locale string.
* @internal
*/
void setFromPOSIXID(const char *posixID);
+#endif /* U_HIDE_INTERNAL_API */
private:
/**
@@ -695,6 +723,7 @@ private:
* Was deprecated - used in implementation - moved internal
*
* @param cLocaleID The new locale name.
+ * @param canonicalize whether to call uloc_canonicalize on cLocaleID
*/
Locale& init(const char* cLocaleID, UBool canonicalize);
@@ -721,7 +750,7 @@ private:
char fullNameBuffer[ULOC_FULLNAME_CAPACITY];
// name without keywords
char* baseName;
- char baseNameBuffer[ULOC_FULLNAME_CAPACITY];
+ void initBaseName(UErrorCode& status);
UBool fIsBogus;
@@ -731,7 +760,12 @@ private:
* A friend to allow the default locale to be set by either the C or C++ API.
* @internal
*/
- friend void locale_set_default_internal(const char *);
+ friend Locale *locale_set_default_internal(const char *, UErrorCode& status);
+
+ /**
+ * @internal
+ */
+ friend void U_CALLCONV locale_available_init();
};
inline UBool
@@ -761,7 +795,6 @@ Locale::getScript() const
inline const char *
Locale::getVariant() const
{
- getBaseName(); // lazy init
return &baseName[variantBegin];
}