From 773518b3e0cf4296131a307a460013ac6d9eefa8 Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 23 Nov 1999 01:31:13 +0000 Subject: [PATCH] ICU-44 Update transliterator code to use Unicode::digit. X-SVN-Rev: 232 --- icu4c/source/i18n/hextouni.cpp | 6 +++--- icu4c/source/i18n/uniset.cpp | 24 +++--------------------- icu4c/source/i18n/uniset.h | 8 -------- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/icu4c/source/i18n/hextouni.cpp b/icu4c/source/i18n/hextouni.cpp index 02a6da3948b..598d777da67 100644 --- a/icu4c/source/i18n/hextouni.cpp +++ b/icu4c/source/i18n/hextouni.cpp @@ -10,7 +10,7 @@ #include "hextouni.h" #include "rep.h" #include "unifilt.h" -#include "uniset.h" // For UnicodeSet::digit REMOVE LATER +#include "unicode.h" /** * ID for this transliterator. @@ -80,7 +80,7 @@ void HexToUnicodeTransliterator::handleKeyboardTransliterate(Replaceable& text, while (cursor <= maxCursor) { UChar c = filteredCharAt(text, cursor + 5); - int32_t digit0 = UnicodeSet::digit(c, 16); + int32_t digit0 = Unicode::digit(c, 16); if (digit0 < 0) { if (c == '\\') { cursor += 5; @@ -97,7 +97,7 @@ void HexToUnicodeTransliterator::handleKeyboardTransliterate(Replaceable& text, for (int32_t i=4; i>=2; --i) { c = filteredCharAt(text, cursor + i); - int32_t digit = UnicodeSet::digit(c, 16); + int32_t digit = Unicode::digit(c, 16); if (digit < 0) { if (c == 'U' || c == 'u' || c == '+') { cursor += i-1; diff --git a/icu4c/source/i18n/uniset.cpp b/icu4c/source/i18n/uniset.cpp index 04314dd5bd3..4422f9bd449 100644 --- a/icu4c/source/i18n/uniset.cpp +++ b/icu4c/source/i18n/uniset.cpp @@ -1,6 +1,7 @@ /* ********************************************************************** -* Copyright (C) 1999 Alan Liu and others. All rights reserved. +* Copyright (C) 1999, International Business Machines +* Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description * 10/20/99 alan Creation. @@ -465,9 +466,7 @@ UnicodeString& UnicodeSet::parse(UnicodeString& pairsBuf /*result*/, } c = (UChar)0x0000; for (int32_t j=(++i)+4; i= (UChar)'a' && c <= (UChar)'f') { - d = c - (UChar)('a' - 10); - } else if (c >= (UChar)'A' && c <= (UChar)'F') { - d = c - (UChar)('A' - 10); - } - } - return (int8_t)d; -} diff --git a/icu4c/source/i18n/uniset.h b/icu4c/source/i18n/uniset.h index bec14534355..d1f445f6c18 100644 --- a/icu4c/source/i18n/uniset.h +++ b/icu4c/source/i18n/uniset.h @@ -595,14 +595,6 @@ private: * there is none. */ static UChar charAfter(const UnicodeString& str, int32_t i); - -public: // Make public for HexToUnicodeTransliterator - /** - * TEMPORARY WORKAROUND UNTIL Unicode::digit() exists. - * Return the digit value of the given UChar, or -1. The radix - * value is ignored for now and hardcoded as 16. - */ - static int8_t digit(UChar c, int8_t radix); }; inline void UnicodeSet::applyPattern(const UnicodeString& pattern,