ICU-9013 deprecate API for Unicode 1.0 character names & ISO comments, remove support & data
X-SVN-Rev: 31125
This commit is contained in:
parent
b0702b4677
commit
2f70694e7f
@ -700,6 +700,18 @@ enumNames(UCharNames *names,
|
|||||||
/* find the group that contains start, or the highest before it */
|
/* find the group that contains start, or the highest before it */
|
||||||
group=getGroup(names, start);
|
group=getGroup(names, start);
|
||||||
|
|
||||||
|
if(startGroupMSB<group[GROUP_MSB] && nameChoice==U_EXTENDED_CHAR_NAME) {
|
||||||
|
/* enumerate synthetic names between start and the group start */
|
||||||
|
UChar32 extLimit=((UChar32)group[GROUP_MSB]<<GROUP_SHIFT);
|
||||||
|
if(extLimit>limit) {
|
||||||
|
extLimit=limit;
|
||||||
|
}
|
||||||
|
if(!enumExtNames(start, extLimit-1, fn, context)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
start=extLimit;
|
||||||
|
}
|
||||||
|
|
||||||
if(startGroupMSB==endGroupMSB) {
|
if(startGroupMSB==endGroupMSB) {
|
||||||
if(startGroupMSB==group[GROUP_MSB]) {
|
if(startGroupMSB==group[GROUP_MSB]) {
|
||||||
/* if start and limit-1 are in the same group, then enumerate only in that one */
|
/* if start and limit-1 are in the same group, then enumerate only in that one */
|
||||||
@ -1508,11 +1520,9 @@ u_charName(UChar32 code, UCharNameChoice nameChoice,
|
|||||||
}
|
}
|
||||||
|
|
||||||
U_CAPI int32_t U_EXPORT2
|
U_CAPI int32_t U_EXPORT2
|
||||||
u_getISOComment(UChar32 c,
|
u_getISOComment(UChar32 /*c*/,
|
||||||
char *dest, int32_t destCapacity,
|
char *dest, int32_t destCapacity,
|
||||||
UErrorCode *pErrorCode) {
|
UErrorCode *pErrorCode) {
|
||||||
int32_t length;
|
|
||||||
|
|
||||||
/* check the argument values */
|
/* check the argument values */
|
||||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -1521,13 +1531,7 @@ u_getISOComment(UChar32 c,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((uint32_t)c>UCHAR_MAX_VALUE || !isDataLoaded(pErrorCode)) {
|
return u_terminateChars(dest, destCapacity, 0, pErrorCode);
|
||||||
return u_terminateChars(dest, destCapacity, 0, pErrorCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the ISO comment is stored like a normal character name */
|
|
||||||
length=getName(uCharNames, (uint32_t)c, U_ISO_COMMENT, dest, (uint16_t)destCapacity);
|
|
||||||
return u_terminateChars(dest, destCapacity, length, pErrorCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
U_CAPI UChar32 U_EXPORT2
|
U_CAPI UChar32 U_EXPORT2
|
||||||
|
@ -527,8 +527,8 @@ typedef enum UProperty {
|
|||||||
/** String property Case_Folding.
|
/** String property Case_Folding.
|
||||||
Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */
|
Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */
|
||||||
UCHAR_CASE_FOLDING=0x4002,
|
UCHAR_CASE_FOLDING=0x4002,
|
||||||
/** String property ISO_Comment.
|
/** Deprecated string property ISO_Comment.
|
||||||
Corresponds to u_getISOComment. @stable ICU 2.4 */
|
Corresponds to u_getISOComment. @deprecated ICU 49 */
|
||||||
UCHAR_ISO_COMMENT=0x4003,
|
UCHAR_ISO_COMMENT=0x4003,
|
||||||
/** String property Lowercase_Mapping.
|
/** String property Lowercase_Mapping.
|
||||||
Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */
|
Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */
|
||||||
@ -552,7 +552,9 @@ typedef enum UProperty {
|
|||||||
Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */
|
Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */
|
||||||
UCHAR_TITLECASE_MAPPING=0x400A,
|
UCHAR_TITLECASE_MAPPING=0x400A,
|
||||||
/** String property Unicode_1_Name.
|
/** String property Unicode_1_Name.
|
||||||
Corresponds to u_charName. @stable ICU 2.4 */
|
This property is of little practical value.
|
||||||
|
Beginning with ICU 49, ICU APIs return an empty string for this property.
|
||||||
|
Corresponds to u_charName(U_UNICODE_10_CHAR_NAME). @deprecated ICU 49 */
|
||||||
UCHAR_UNICODE_1_NAME=0x400B,
|
UCHAR_UNICODE_1_NAME=0x400B,
|
||||||
/** String property Uppercase_Mapping.
|
/** String property Uppercase_Mapping.
|
||||||
Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */
|
Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */
|
||||||
@ -1451,10 +1453,19 @@ typedef enum UEastAsianWidth {
|
|||||||
* @stable ICU 2.0
|
* @stable ICU 2.0
|
||||||
*/
|
*/
|
||||||
typedef enum UCharNameChoice {
|
typedef enum UCharNameChoice {
|
||||||
|
/** Unicode character name (Name property). @stable ICU 2.0 */
|
||||||
U_UNICODE_CHAR_NAME,
|
U_UNICODE_CHAR_NAME,
|
||||||
|
/**
|
||||||
|
* The Unicode_1_Name property value which is of little practical value.
|
||||||
|
* Beginning with ICU 49, ICU APIs return an empty string for this name choice.
|
||||||
|
* @deprecated ICU 49
|
||||||
|
*/
|
||||||
U_UNICODE_10_CHAR_NAME,
|
U_UNICODE_10_CHAR_NAME,
|
||||||
|
/** Standard or synthetic character name. @stable ICU 2.0 */
|
||||||
U_EXTENDED_CHAR_NAME,
|
U_EXTENDED_CHAR_NAME,
|
||||||
U_CHAR_NAME_ALIAS, /**< Corrected name from NameAliases.txt. @stable ICU 4.4 */
|
/** Corrected name from NameAliases.txt. @stable ICU 4.4 */
|
||||||
|
U_CHAR_NAME_ALIAS,
|
||||||
|
/** @stable ICU 2.0 */
|
||||||
U_CHAR_NAME_CHOICE_COUNT
|
U_CHAR_NAME_CHOICE_COUNT
|
||||||
} UCharNameChoice;
|
} UCharNameChoice;
|
||||||
|
|
||||||
@ -2584,12 +2595,9 @@ u_charName(UChar32 code, UCharNameChoice nameChoice,
|
|||||||
UErrorCode *pErrorCode);
|
UErrorCode *pErrorCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ISO 10646 comment for a character.
|
* Returns an empty string.
|
||||||
* The ISO 10646 comment is an informative field in the Unicode Character
|
* Used to return the ISO 10646 comment for a character.
|
||||||
* Database (UnicodeData.txt field 11) and is from the ISO 10646 names list.
|
* The Unicode ISO_Comment property is deprecated and has no values.
|
||||||
*
|
|
||||||
* Note: Unicode 5.2 removes all ISO comment data, resulting in empty strings
|
|
||||||
* returned for all characters.
|
|
||||||
*
|
*
|
||||||
* @param c The character (code point) for which to get the ISO comment.
|
* @param c The character (code point) for which to get the ISO comment.
|
||||||
* It must be <code>0<=c<=0x10ffff</code>.
|
* It must be <code>0<=c<=0x10ffff</code>.
|
||||||
@ -2600,13 +2608,9 @@ u_charName(UChar32 code, UCharNameChoice nameChoice,
|
|||||||
* @param pErrorCode Pointer to a UErrorCode variable;
|
* @param pErrorCode Pointer to a UErrorCode variable;
|
||||||
* check for <code>U_SUCCESS()</code> after <code>u_getISOComment()</code>
|
* check for <code>U_SUCCESS()</code> after <code>u_getISOComment()</code>
|
||||||
* returns.
|
* returns.
|
||||||
* @return The length of the comment, or 0 if there is no comment for this character.
|
* @return 0
|
||||||
* If the destCapacity is less than or equal to the length, then the buffer
|
|
||||||
* contains the truncated name and the returned length indicates the full
|
|
||||||
* length of the name.
|
|
||||||
* The length does not include the zero-termination.
|
|
||||||
*
|
*
|
||||||
* @stable ICU 2.2
|
* @deprecated ICU 49
|
||||||
*/
|
*/
|
||||||
U_STABLE int32_t U_EXPORT2
|
U_STABLE int32_t U_EXPORT2
|
||||||
u_getISOComment(UChar32 c,
|
u_getISOComment(UChar32 c,
|
||||||
|
@ -1040,15 +1040,12 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UCHAR_NAME:
|
case UCHAR_NAME:
|
||||||
case UCHAR_UNICODE_1_NAME:
|
|
||||||
{
|
{
|
||||||
// Must munge name, since u_charFromName() does not do
|
// Must munge name, since u_charFromName() does not do
|
||||||
// 'loose' matching.
|
// 'loose' matching.
|
||||||
char buf[128]; // it suffices that this be > uprv_getMaxCharNameLength
|
char buf[128]; // it suffices that this be > uprv_getMaxCharNameLength
|
||||||
if (!mungeCharName(buf, vname.data(), sizeof(buf))) FAIL(ec);
|
if (!mungeCharName(buf, vname.data(), sizeof(buf))) FAIL(ec);
|
||||||
UCharNameChoice choice = (p == UCHAR_NAME) ?
|
UChar32 ch = u_charFromName(U_EXTENDED_CHAR_NAME, buf, &ec);
|
||||||
U_EXTENDED_CHAR_NAME : U_UNICODE_10_CHAR_NAME;
|
|
||||||
UChar32 ch = u_charFromName(choice, buf, &ec);
|
|
||||||
if (U_SUCCESS(ec)) {
|
if (U_SUCCESS(ec)) {
|
||||||
clear();
|
clear();
|
||||||
add(ch);
|
add(ch);
|
||||||
@ -1058,6 +1055,9 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case UCHAR_UNICODE_1_NAME:
|
||||||
|
// ICU 49 deprecates the Unicode_1_Name property APIs.
|
||||||
|
FAIL(ec);
|
||||||
case UCHAR_AGE:
|
case UCHAR_AGE:
|
||||||
{
|
{
|
||||||
// Must munge name, since u_versionFromString() does not do
|
// Must munge name, since u_versionFromString() does not do
|
||||||
|
Binary file not shown.
@ -58,20 +58,13 @@ void prettyPrintUChar(UChar c)
|
|||||||
char buf[1000];
|
char buf[1000];
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
int32_t o;
|
int32_t o;
|
||||||
|
|
||||||
o = u_charName(c, U_UNICODE_CHAR_NAME, buf, 1000, &status);
|
o = u_charName(c, U_EXTENDED_CHAR_NAME, buf, 1000, &status);
|
||||||
if(U_SUCCESS(status) && (o>0) ) {
|
if(U_SUCCESS(status) && (o>0) ) {
|
||||||
buf[6] = 0;
|
buf[6] = 0;
|
||||||
printf("%7s", buf);
|
printf("%7s", buf);
|
||||||
} else {
|
} else {
|
||||||
o = u_charName(c, U_UNICODE_10_CHAR_NAME, buf, 1000, &status);
|
printf(" ??????");
|
||||||
if(U_SUCCESS(status) && (o>0)) {
|
|
||||||
buf[5] = 0;
|
|
||||||
printf("~%6s", buf);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf(" ??????");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch((char)(c & 0x007F)) {
|
switch((char)(c & 0x007F)) {
|
||||||
|
@ -1581,12 +1581,10 @@ static const struct {
|
|||||||
const char *name, *oldName, *extName, *alias;
|
const char *name, *oldName, *extName, *alias;
|
||||||
} names[]={
|
} names[]={
|
||||||
{0x0061, "LATIN SMALL LETTER A", "", "LATIN SMALL LETTER A"},
|
{0x0061, "LATIN SMALL LETTER A", "", "LATIN SMALL LETTER A"},
|
||||||
{0x01a2, "LATIN CAPITAL LETTER OI",
|
{0x01a2, "LATIN CAPITAL LETTER OI", "",
|
||||||
"LATIN CAPITAL LETTER O I",
|
|
||||||
"LATIN CAPITAL LETTER OI",
|
"LATIN CAPITAL LETTER OI",
|
||||||
"LATIN CAPITAL LETTER GHA"},
|
"LATIN CAPITAL LETTER GHA"},
|
||||||
{0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK",
|
{0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", "",
|
||||||
"LATIN SMALL LETTER DOTLESS J BAR HOOK",
|
|
||||||
"LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK" },
|
"LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK" },
|
||||||
{0x0fd0, "TIBETAN MARK BSKA- SHOG GI MGO RGYAN", "",
|
{0x0fd0, "TIBETAN MARK BSKA- SHOG GI MGO RGYAN", "",
|
||||||
"TIBETAN MARK BSKA- SHOG GI MGO RGYAN",
|
"TIBETAN MARK BSKA- SHOG GI MGO RGYAN",
|
||||||
@ -1597,7 +1595,7 @@ static const struct {
|
|||||||
{0xd7a3, "HANGUL SYLLABLE HIH", "", "HANGUL SYLLABLE HIH" },
|
{0xd7a3, "HANGUL SYLLABLE HIH", "", "HANGUL SYLLABLE HIH" },
|
||||||
{0xd800, "", "", "<lead surrogate-D800>" },
|
{0xd800, "", "", "<lead surrogate-D800>" },
|
||||||
{0xdc00, "", "", "<trail surrogate-DC00>" },
|
{0xdc00, "", "", "<trail surrogate-DC00>" },
|
||||||
{0xff08, "FULLWIDTH LEFT PARENTHESIS", "FULLWIDTH OPENING PARENTHESIS", "FULLWIDTH LEFT PARENTHESIS" },
|
{0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS" },
|
||||||
{0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN" },
|
{0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN" },
|
||||||
{0xffff, "", "", "<noncharacter-FFFF>" },
|
{0xffff, "", "", "<noncharacter-FFFF>" },
|
||||||
{0x1d0c5, "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS", "",
|
{0x1d0c5, "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS", "",
|
||||||
|
@ -1277,8 +1277,8 @@ void TransliteratorTest::TestNameMap(void) {
|
|||||||
|
|
||||||
// Careful: CharsToUS will convert "\\N" => "N"; use "\\\\N" for \N
|
// Careful: CharsToUS will convert "\\N" => "N"; use "\\\\N" for \N
|
||||||
expect(*uni2name, CharsToUnicodeString("\\u00A0abc\\u4E01\\u00B5\\u0A81\\uFFFD\\u0004\\u0009\\u0081\\uFFFF"),
|
expect(*uni2name, CharsToUnicodeString("\\u00A0abc\\u4E01\\u00B5\\u0A81\\uFFFD\\u0004\\u0009\\u0081\\uFFFF"),
|
||||||
CharsToUnicodeString("\\\\N{NO-BREAK SPACE}abc\\\\N{CJK UNIFIED IDEOGRAPH-4E01}\\\\N{MICRO SIGN}\\\\N{GUJARATI SIGN CANDRABINDU}\\\\N{REPLACEMENT CHARACTER}\\\\N{END OF TRANSMISSION}\\\\N{CHARACTER TABULATION}\\\\N{<control-0081>}\\\\N{<noncharacter-FFFF>}"));
|
CharsToUnicodeString("\\\\N{NO-BREAK SPACE}abc\\\\N{CJK UNIFIED IDEOGRAPH-4E01}\\\\N{MICRO SIGN}\\\\N{GUJARATI SIGN CANDRABINDU}\\\\N{REPLACEMENT CHARACTER}\\\\N{<control-0004>}\\\\N{<control-0009>}\\\\N{<control-0081>}\\\\N{<noncharacter-FFFF>}"));
|
||||||
expect(*name2uni, UNICODE_STRING_SIMPLE("{\\N { NO-BREAK SPACE}abc\\N{ CJK UNIFIED IDEOGRAPH-4E01 }\\N{x\\N{MICRO SIGN}\\N{GUJARATI SIGN CANDRABINDU}\\N{REPLACEMENT CHARACTER}\\N{END OF TRANSMISSION}\\N{CHARACTER TABULATION}\\N{<control-0081>}\\N{<noncharacter-FFFF>}\\N{<control-0004>}\\N{"),
|
expect(*name2uni, UNICODE_STRING_SIMPLE("{\\N { NO-BREAK SPACE}abc\\N{ CJK UNIFIED IDEOGRAPH-4E01 }\\N{x\\N{MICRO SIGN}\\N{GUJARATI SIGN CANDRABINDU}\\N{REPLACEMENT CHARACTER}\\N{<control-0004>}\\N{<control-0009>}\\N{<control-0081>}\\N{<noncharacter-FFFF>}\\N{<control-0004>}\\N{"),
|
||||||
CharsToUnicodeString("{\\u00A0abc\\u4E01\\\\N{x\\u00B5\\u0A81\\uFFFD\\u0004\\u0009\\u0081\\uFFFF\\u0004\\\\N{"));
|
CharsToUnicodeString("{\\u00A0abc\\u4E01\\\\N{x\\u00B5\\u0A81\\uFFFD\\u0004\\u0009\\u0081\\uFFFF\\u0004\\\\N{"));
|
||||||
|
|
||||||
delete uni2name;
|
delete uni2name;
|
||||||
|
Loading…
Reference in New Issue
Block a user