X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/51004dcb01e06fef634b61be77ed73dd61cb6db9..277af7082f210d5fa7e37ce63392ac8568371616:/icuSources/common/unicode/uscript.h diff --git a/icuSources/common/unicode/uscript.h b/icuSources/common/unicode/uscript.h index 7949974b..a5fb1670 100644 --- a/icuSources/common/unicode/uscript.h +++ b/icuSources/common/unicode/uscript.h @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (C) 1997-2013, International Business Machines + * Copyright (C) 1997-2015, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -21,25 +21,31 @@ * \file * \brief C API: Unicode Script Information */ - + /** * Constants for ISO 15924 script codes. * - * Many of these script codes - those from Unicode's ScriptNames.txt - - * are character property values for Unicode's Script property. - * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/). + * The current set of script code constants supports at least all scripts + * that are encoded in the version of Unicode which ICU currently supports. + * The names of the constants are usually derived from the + * Unicode script property value aliases. + * See UAX #24 Unicode Script Property (http://www.unicode.org/reports/tr24/) + * and http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt . * * Starting with ICU 3.6, constants for most ISO 15924 script codes - * are included (currently excluding private-use codes Qaaa..Qabx). - * For scripts for which there are codes in ISO 15924 but which are not - * used in the Unicode Character Database (UCD), there are no Unicode characters - * associated with those scripts. + * are included, for use with language tags, CLDR data, and similar. + * Some of those codes are not used in the Unicode Character Database (UCD). + * For example, there are no characters that have a UCD script property value of + * Hans or Hant. All Han ideographs have the Hani script property value in Unicode. * - * For example, there are no characters that have a UCD script code of - * Hans or Hant. All Han ideographs have the Hani script code. - * The Hans and Hant script codes are used with CLDR data. + * Private-use codes Qaaa..Qabx are not included. * - * ISO 15924 script codes are included for use with CLDR and similar. + * Starting with ICU 55, script codes are only added when their scripts + * have been or will certainly be encoded in Unicode, + * and have been assigned Unicode script property value aliases, + * to ensure that their script names are stable and match the names of the constants. + * Script codes like Latf and Aran that are not subject to separate encoding + * may be added at any time. * * @stable ICU 2.2 */ @@ -186,7 +192,7 @@ typedef enum UScriptCode { /** @stable ICU 3.4 */ USCRIPT_OLD_PERSIAN = 61, /* Xpeo */ - /* New script codes from ISO 15924 */ + /* New script codes from Unicode and ISO 15924 */ /** @stable ICU 3.6 */ USCRIPT_BALINESE = 62, /* Bali */ /** @stable ICU 3.6 */ @@ -251,8 +257,10 @@ typedef enum UScriptCode { USCRIPT_PHAGS_PA = 90, /* Phag */ /** @stable ICU 3.6 */ USCRIPT_PHOENICIAN = 91, /* Phnx */ + /** @stable ICU 52 */ + USCRIPT_MIAO = 92, /* Plrd */ /** @stable ICU 3.6 */ - USCRIPT_PHONETIC_POLLARD = 92, /* Plrd */ + USCRIPT_PHONETIC_POLLARD = USCRIPT_MIAO, /** @stable ICU 3.6 */ USCRIPT_RONGORONGO = 93, /* Roro */ /** @stable ICU 3.6 */ @@ -276,7 +284,6 @@ typedef enum UScriptCode { /** @stable ICU 3.6 */ USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */ - /* New script codes from ISO 15924 */ /** @stable ICU 3.8 */ USCRIPT_CARIAN = 104,/* Cari */ /** @stable ICU 3.8 */ @@ -293,7 +300,7 @@ typedef enum UScriptCode { USCRIPT_REJANG = 110,/* Rjng */ /** @stable ICU 3.8 */ USCRIPT_SAURASHTRA = 111,/* Saur */ - /** @stable ICU 3.8 */ + /** Sutton SignWriting @stable ICU 3.8 */ USCRIPT_SIGN_WRITING = 112,/* Sgnw */ /** @stable ICU 3.8 */ USCRIPT_SUNDANESE = 113,/* Sund */ @@ -302,7 +309,6 @@ typedef enum UScriptCode { /** @stable ICU 3.8 */ USCRIPT_MEITEI_MAYEK = 115,/* Mtei */ - /* New script codes from ISO 15924 */ /** @stable ICU 4.0 */ USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */ /** @stable ICU 4.0 */ @@ -332,7 +338,6 @@ typedef enum UScriptCode { /** @stable ICU 4.0 */ USCRIPT_SYMBOLS = 129,/* Zsym */ - /* New script codes from ISO 15924 */ /** @stable ICU 4.4 */ USCRIPT_BAMUM = 130,/* Bamu */ /** @stable ICU 4.4 */ @@ -342,11 +347,14 @@ typedef enum UScriptCode { /** @stable ICU 4.4 */ USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */ - /* New script codes from ISO 15924 */ /** @stable ICU 4.6 */ USCRIPT_BASSA_VAH = 134,/* Bass */ - /** @stable ICU 4.6 */ - USCRIPT_DUPLOYAN_SHORTAND = 135,/* Dupl */ + /** @stable ICU 54 */ + USCRIPT_DUPLOYAN = 135,/* Dupl */ +#ifndef U_HIDE_DEPRECATED_API + /** @deprecated ICU 54 Typo, use USCRIPT_DUPLOYAN */ + USCRIPT_DUPLOYAN_SHORTAND = USCRIPT_DUPLOYAN, +#endif /* U_HIDE_DEPRECATED_API */ /** @stable ICU 4.6 */ USCRIPT_ELBASAN = 136,/* Elba */ /** @stable ICU 4.6 */ @@ -355,7 +363,7 @@ typedef enum UScriptCode { USCRIPT_KPELLE = 138,/* Kpel */ /** @stable ICU 4.6 */ USCRIPT_LOMA = 139,/* Loma */ - /** @stable ICU 4.6 */ + /** Mende Kikakui @stable ICU 4.6 */ USCRIPT_MENDE = 140,/* Mend */ /** @stable ICU 4.6 */ USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */ @@ -365,8 +373,10 @@ typedef enum UScriptCode { USCRIPT_NABATAEAN = 143,/* Nbat */ /** @stable ICU 4.6 */ USCRIPT_PALMYRENE = 144,/* Palm */ + /** @stable ICU 54 */ + USCRIPT_KHUDAWADI = 145,/* Sind */ /** @stable ICU 4.6 */ - USCRIPT_SINDHI = 145,/* Sind */ + USCRIPT_SINDHI = USCRIPT_KHUDAWADI, /** @stable ICU 4.6 */ USCRIPT_WARANG_CITI = 146,/* Wara */ @@ -396,22 +406,49 @@ typedef enum UScriptCode { /** @stable ICU 49 */ USCRIPT_TIRHUTA = 158,/* Tirh */ - /* Private use codes from Qaaa - Qabx are not supported */ - - /** @stable ICU 2.2 */ - USCRIPT_CODE_LIMIT = 159 + /** @stable ICU 52 */ + USCRIPT_CAUCASIAN_ALBANIAN = 159,/* Aghb */ + /** @stable ICU 52 */ + USCRIPT_MAHAJANI = 160,/* Mahj */ + + /** @stable ICU 54 */ + USCRIPT_AHOM = 161,/* Ahom */ + /** @stable ICU 54 */ + USCRIPT_HATRAN = 162,/* Hatr */ + /** @stable ICU 54 */ + USCRIPT_MODI = 163,/* Modi */ + /** @stable ICU 54 */ + USCRIPT_MULTANI = 164,/* Mult */ + /** @stable ICU 54 */ + USCRIPT_PAU_CIN_HAU = 165,/* Pauc */ + /** @stable ICU 54 */ + USCRIPT_SIDDHAM = 166,/* Sidd */ + + /** + * One higher than the last script code constant. + * This value increases as constants for script codes are added. + * + * There are constants for Unicode 7 script property values. + * There are constants for ISO 15924 script codes assigned on or before 2013-10-12. + * There are no constants for private use codes from Qaaa - Qabx + * except as used in the UCD. + * + * @stable ICU 2.2 + */ + USCRIPT_CODE_LIMIT = 167 } UScriptCode; /** - * Gets script codes associated with the given locale or ISO 15924 abbreviation or name. + * Gets the script codes associated with the given locale or ISO 15924 abbreviation or name. * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". * Fills in USCRIPT_LATIN given "en" OR "en_US" - * If required capacity is greater than capacity of the destination buffer then the error code - * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned + * If the required capacity is greater than the capacity of the destination buffer, + * then the error code is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned. * *

Note: To search by short or long script alias only, use - * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. This does + * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. That does * a fast lookup with no access of the locale data. + * * @param nameOrAbbrOrLocale name of the script, as given in * PropertyValueAliases.txt, or ISO 15924 code or locale * @param fillIn the UScriptCode buffer to fill in the script code @@ -424,22 +461,25 @@ U_STABLE int32_t U_EXPORT2 uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); /** - * Gets a script name associated with the given script code. - * Returns "Malayam" given USCRIPT_MALAYALAM + * Returns the long Unicode script name, if there is one. + * Otherwise returns the 4-letter ISO 15924 script code. + * Returns "Malayam" given USCRIPT_MALAYALAM. + * * @param scriptCode UScriptCode enum - * @return script long name as given in - * PropertyValueAliases.txt, or NULL if scriptCode is invalid + * @return long script name as given in PropertyValueAliases.txt, or the 4-letter code, + * or NULL if scriptCode is invalid * @stable ICU 2.4 */ U_STABLE const char* U_EXPORT2 uscript_getName(UScriptCode scriptCode); /** - * Gets a script name associated with the given script code. - * Returns "Mlym" given USCRIPT_MALAYALAM + * Returns the 4-letter ISO 15924 script code, + * which is the same as the short Unicode script name if Unicode has names for the script. + * Returns "Mlym" given USCRIPT_MALAYALAM. + * * @param scriptCode UScriptCode enum - * @return script abbreviated name as given in - * PropertyValueAliases.txt, or NULL if scriptCode is invalid + * @return short script name (4-letter code), or NULL if scriptCode is invalid * @stable ICU 2.4 */ U_STABLE const char* U_EXPORT2 @@ -510,27 +550,25 @@ uscript_getScriptExtensions(UChar32 c, UScriptCode *scripts, int32_t capacity, UErrorCode *errorCode); -#ifndef U_HIDE_DRAFT_API - /** * Script usage constants. * See UAX #31 Unicode Identifier and Pattern Syntax. * http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers * - * @draft ICU 51 + * @stable ICU 51 */ typedef enum UScriptUsage { - /** Not encoded in Unicode. @draft ICU 51 */ + /** Not encoded in Unicode. @stable ICU 51 */ USCRIPT_USAGE_NOT_ENCODED, - /** Unknown script usage. @draft ICU 51 */ + /** Unknown script usage. @stable ICU 51 */ USCRIPT_USAGE_UNKNOWN, - /** Candidate for Exclusion from Identifiers. @draft ICU 51 */ + /** Candidate for Exclusion from Identifiers. @stable ICU 51 */ USCRIPT_USAGE_EXCLUDED, - /** Limited Use script. @draft ICU 51 */ + /** Limited Use script. @stable ICU 51 */ USCRIPT_USAGE_LIMITED_USE, - /** Aspirational Use script. @draft ICU 51 */ + /** Aspirational Use script. @stable ICU 51 */ USCRIPT_USAGE_ASPIRATIONAL, - /** Recommended script. @draft ICU 51 */ + /** Recommended script. @stable ICU 51 */ USCRIPT_USAGE_RECOMMENDED } UScriptUsage; @@ -544,9 +582,9 @@ typedef enum UScriptUsage { * @param capacity number of UChars in the dest array * @param pErrorCode standard ICU in/out error code, must pass U_SUCCESS() on input * @return the string length, even if U_BUFFER_OVERFLOW_ERROR - * @draft ICU 51 + * @stable ICU 51 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode); #if U_SHOW_CPLUSPLUS_API @@ -562,7 +600,7 @@ U_NAMESPACE_END * * @param script script code * @return the sample character string - * @draft ICU 51 + * @stable ICU 51 */ U_COMMON_API icu::UnicodeString U_EXPORT2 uscript_getSampleUnicodeString(UScriptCode script); @@ -576,9 +614,9 @@ uscript_getSampleUnicodeString(UScriptCode script); * @param script script code * @return script usage * @see UScriptUsage - * @draft ICU 51 + * @stable ICU 51 */ -U_DRAFT UScriptUsage U_EXPORT2 +U_STABLE UScriptUsage U_EXPORT2 uscript_getUsage(UScriptCode script); /** @@ -587,9 +625,9 @@ uscript_getUsage(UScriptCode script); * * @param script script code * @return TRUE if the script is right-to-left - * @draft ICU 51 + * @stable ICU 51 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 uscript_isRightToLeft(UScriptCode script); /** @@ -599,9 +637,9 @@ uscript_isRightToLeft(UScriptCode script); * * @param script script code * @return TRUE if the script allows line breaks between letters - * @draft ICU 51 + * @stable ICU 51 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 uscript_breaksBetweenLetters(UScriptCode script); /** @@ -610,11 +648,9 @@ uscript_breaksBetweenLetters(UScriptCode script); * * @param script script code * @return TRUE if the script is cased - * @draft ICU 51 + * @stable ICU 51 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 uscript_isCased(UScriptCode script); -#endif /* U_HIDE_DRAFT_API */ - #endif