summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-02-12 13:01:16 -0800
committerKenny Root <kroot@google.com>2010-02-12 13:01:16 -0800
commit196e3207345baa4ba5af93646f2ca1b67a438aeb (patch)
tree2738aede10416d2418222aa6d611d27fe1e74838
parentfe7a18c4e17a179a0f26e139d3eae20393c1a8ae (diff)
downloadframeworks_native-196e3207345baa4ba5af93646f2ca1b67a438aeb.zip
frameworks_native-196e3207345baa4ba5af93646f2ca1b67a438aeb.tar.gz
frameworks_native-196e3207345baa4ba5af93646f2ca1b67a438aeb.tar.bz2
Excise code from Unicode.cpp that was dead
Remove some utility functions for discovering character data that ICU probably took over a while ago. Change-Id: I97abe4de2f51eb2bf48679941258bc501184c3dc
-rw-r--r--include/utils/AndroidUnicode.h127
-rw-r--r--libs/utils/CharacterData.h41
-rw-r--r--libs/utils/Unicode.cpp61
3 files changed, 0 insertions, 229 deletions
diff --git a/include/utils/AndroidUnicode.h b/include/utils/AndroidUnicode.h
index 563fcd0..2b185d3 100644
--- a/include/utils/AndroidUnicode.h
+++ b/include/utils/AndroidUnicode.h
@@ -79,69 +79,6 @@ namespace android {
};
/**
- * Character types as specified in the Unicode standard. These map directly to
- * java.lang.Character.
- */
- enum CharType {
- CHARTYPE_UNASSIGNED = 0,
- CHARTYPE_UPPERCASE_LETTER,
- CHARTYPE_LOWERCASE_LETTER,
- CHARTYPE_TITLECASE_LETTER,
- CHARTYPE_MODIFIER_LETTER,
- CHARTYPE_OTHER_LETTER,
- CHARTYPE_NON_SPACING_MARK,
- CHARTYPE_ENCLOSING_MARK,
- CHARTYPE_COMBINING_SPACING_MARK,
- CHARTYPE_DECIMAL_DIGIT_NUMBER,
- CHARTYPE_LETTER_NUMBER,
- CHARTYPE_OTHER_NUMBER,
- CHARTYPE_SPACE_SEPARATOR,
- CHARTYPE_LINE_SEPARATOR,
- CHARTYPE_PARAGRAPH_SEPARATOR,
- CHARTYPE_CONTROL,
- CHARTYPE_FORMAT,
- CHARTYPE_MISSING_VALUE_FOR_JAVA, /* This is the mysterious missing 17 value from the java constants */
- CHARTYPE_PRIVATE_USE,
- CHARTYPE_SURROGATE,
- CHARTYPE_DASH_PUNCTUATION,
- CHARTYPE_START_PUNCTUATION,
- CHARTYPE_END_PUNCTUATION,
- CHARTYPE_CONNECTOR_PUNCTUATION,
- CHARTYPE_OTHER_PUNCTUATION,
- CHARTYPE_MATH_SYMBOL,
- CHARTYPE_CURRENCY_SYMBOL,
- CHARTYPE_MODIFIER_SYMBOL,
- CHARTYPE_OTHER_SYMBOL,
- CHARTYPE_INITIAL_QUOTE_PUNCTUATION,
- CHARTYPE_FINAL_QUOTE_PUNCTUATION
- };
-
- /**
- * Decomposition types as described by the unicode standard. These values map to
- * the same values in uchar.h in ICU.
- */
- enum DecompositionType {
- DECOMPOSITION_NONE = 0,
- DECOMPOSITION_CANONICAL,
- DECOMPOSITION_COMPAT,
- DECOMPOSITION_CIRCLE,
- DECOMPOSITION_FINAL,
- DECOMPOSITION_FONT,
- DECOMPOSITION_FRACTION,
- DECOMPOSITION_INITIAL,
- DECOMPOSITION_ISOLATED,
- DECOMPOSITION_MEDIAL,
- DECOMPOSITION_NARROW,
- DECOMPOSITION_NOBREAK,
- DECOMPOSITION_SMALL,
- DECOMPOSITION_SQUARE,
- DECOMPOSITION_SUB,
- DECOMPOSITION_SUPER,
- DECOMPOSITION_VERTICAL,
- DECOMPOSITION_WIDE
- };
-
- /**
* Returns the packed data for java calls
* @param c The unicode character.
* @return The packed data for the character.
@@ -162,61 +99,6 @@ namespace android {
static uint32_t getPackedData(UChar32 c);
/**
- * Get the Character type.
- * @param c The unicode character.
- * @return The character's type or CHARTYPE_UNASSIGNED if the character is invalid
- * or has an unassigned class.
- */
- static CharType getType(UChar32 c);
-
- /**
- * Get the Character's decomposition type.
- * @param c The unicode character.
- * @return The character's decomposition type or DECOMPOSITION_NONE is there
- * is no decomposition.
- */
- static DecompositionType getDecompositionType(UChar32 c);
-
- /**
- * Returns the digit value of a character or -1 if the character
- * is not within the specified radix.
- *
- * The digit value is computed for integer characters and letters
- * within the given radix. This function does not handle Roman Numerals,
- * fractions, or any other characters that may represent numbers.
- *
- * @param c The unicode character
- * @param radix The intended radix.
- * @return The digit value or -1 if there is no digit value or if the value is outside the radix.
- */
- static int getDigitValue(UChar32 c, int radix = 10);
-
- /**
- * Return the numeric value of a character
- *
- * @param c The unicode character.
- * @return The numeric value of the character. -1 if the character has no numeric value,
- * -2 if the character has a numeric value that is not representable by an integer.
- */
- static int getNumericValue(UChar32 c);
-
- /**
- * Convert the character to lowercase
- * @param c The unicode character.
- * @return The lowercase character equivalent of c. If c does not have a lowercase equivalent,
- * the original character is returned.
- */
- static UChar32 toLower(UChar32 c);
-
- /**
- * Convert the character to uppercase
- * @param c The unicode character.
- * @return The uppercase character equivalent of c. If c does not have an uppercase equivalent,
- * the original character is returned.
- */
- static UChar32 toUpper(UChar32 c);
-
- /**
* Get the directionality of the character.
* @param c The unicode character.
* @return The direction of the character or DIRECTIONALITY_UNDEFINED.
@@ -239,15 +121,6 @@ namespace android {
* @see isMirrored
*/
static UChar32 toMirror(UChar32 c);
-
- /**
- * Convert the character to title case.
- * @param c The unicode character.
- * @return The titlecase equivalent of c. If c does not have a titlecase equivalent,
- * the original character is returned.
- */
- static UChar32 toTitle(UChar32 c);
-
};
}
diff --git a/libs/utils/CharacterData.h b/libs/utils/CharacterData.h
index e931d99..d9b7c56 100644
--- a/libs/utils/CharacterData.h
+++ b/libs/utils/CharacterData.h
@@ -615,32 +615,6 @@ namespace CharacterData {
{0, 0}
};
- // Array of uppercase differences
- static const short UCDIFF[] = {
- 0, -32, 743, 121, -1, -232, -300, 97,
- 163, 130, 56, -2, -79, -210, -206, -205,
- -202, -203, -207, -209, -211, -213, -214, -218,
- -217, -219, -83, 84, -38, -37, -31, -64,
- -63, -62, -57, -47, -54, -86, -80, 7,
- -96, -48, -59, 8, 74, 86, 100, 128,
- 112, 126, 9, -7205, -16, -26, -7264, -40
- };
-
- // Array of lowercase differences
- static const short LCDIFF[] = {
- 0, 32, 1, -199, -121, 210, 206, 205,
- 79, 202, 203, 207, 211, 209, 213, 214,
- 218, 217, 219, 2, -97, -56, -130, -163,
- 83, 38, 37, 64, 63, -60, -7, 80,
- 48, 7264, -8, -74, -9, -86, -100, -112,
- -128, -126, -7517, -8383, -8262, 16, 26, 40
- };
-
- // Array of titlecase differences
- static const short TCDIFF[] = {
- 3, 1, 0, -1
- };
-
// Array of mirrored character differences
static const short MIRROR_DIFF[] = {
0, 1, -1, 2, -2, 16, -16, 3,
@@ -649,21 +623,6 @@ namespace CharacterData {
-2108
};
- // Array of all possible numeric values
- static const int NUMERICS[] = {
- -1, 0, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, -2, 100, 1000,
- 40, 50, 60, 70, 80, 90, 10000, 500,
- 5000, 36, 37, 38, 39, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 200, 300,
- 400, 600, 700, 800, 900, 2000, 3000, 4000,
- 6000, 7000, 8000, 9000, 20000, 30000, 40000, 50000,
- 60000, 70000, 80000, 90000
- };
-
// All possible packed data values, no duplicates
static const uint32_t PACKED_DATA[] = {
0x00000000, 0x0000012F, 0x0000016F, 0x0000014F, 0x0000018F, 0x0000018C, 0x000001B8, 0x000000B8,
diff --git a/libs/utils/Unicode.cpp b/libs/utils/Unicode.cpp
index f92703e..65dbb4a 100644
--- a/libs/utils/Unicode.cpp
+++ b/libs/utils/Unicode.cpp
@@ -103,55 +103,6 @@ uint32_t android::Unicode::getPackedData(UChar32 c)
return CharacterData::PACKED_DATA[findCharacterValue(c) & 0x7FF];
}
-android::Unicode::CharType android::Unicode::getType(UChar32 c)
-{
- if (c < 0 || c >= 0x10FFFF)
- return CHARTYPE_UNASSIGNED;
- return (CharType)((getPackedData(c) >> TYPE_SHIFT) & TYPE_MASK);
-}
-
-android::Unicode::DecompositionType android::Unicode::getDecompositionType(UChar32 c)
-{
- // findCharacterValue returns a 16-bit value with the top 5 bits containing a decomposition type
- // and the remaining bits containing an index.
- return (DecompositionType)((findCharacterValue(c) >> DECOMPOSITION_SHIFT) & DECOMPOSITION_MASK);
-}
-
-int android::Unicode::getDigitValue(UChar32 c, int radix)
-{
- if (radix < MIN_RADIX || radix > MAX_RADIX)
- return -1;
-
- int tempValue = radix;
-
- if (c >= '0' && c <= '9')
- tempValue = c - '0';
- else if (c >= 'a' && c <= 'z')
- tempValue = c - 'a' + 10;
- else if (c >= 'A' && c <= 'Z')
- tempValue = c - 'A' + 10;
-
- return tempValue < radix ? tempValue : -1;
-}
-
-int android::Unicode::getNumericValue(UChar32 c)
-{
- if (isMirrored(c))
- return -1;
-
- return (int) CharacterData::NUMERICS[((getPackedData(c) >> NUMERIC_SHIFT) & NUMERIC_MASK)];
-}
-
-UChar32 android::Unicode::toLower(UChar32 c)
-{
- return c + CharacterData::LCDIFF[(getPackedData(c) >> TOLOWER_SHIFT) & TOLOWER_MASK];
-}
-
-UChar32 android::Unicode::toUpper(UChar32 c)
-{
- return c + CharacterData::UCDIFF[(getPackedData(c) >> TOUPPER_SHIFT) & TOUPPER_MASK];
-}
-
android::Unicode::Direction android::Unicode::getDirectionality(UChar32 c)
{
uint32_t data = getPackedData(c);
@@ -179,15 +130,3 @@ UChar32 android::Unicode::toMirror(UChar32 c)
return c + CharacterData::MIRROR_DIFF[(getPackedData(c) >> MIRROR_SHIFT) & MIRROR_MASK];
}
-
-UChar32 android::Unicode::toTitle(UChar32 c)
-{
- int32_t diff = CharacterData::TCDIFF[(getPackedData(c) >> TOTITLE_SHIFT) & TOTITLE_MASK];
-
- if (TOTITLE_MASK == diff)
- return toUpper(c);
-
- return c + diff;
-}
-
-