mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-1576 Rename class Utility to ICU_Utility, to avoid possible conflicts with application classes.
Used by transliteration; may be used by other modules in the future. X-SVN-Rev: 7276
This commit is contained in:
parent
5ef961d839
commit
3ddc3827c9
8 changed files with 25 additions and 25 deletions
|
@ -137,7 +137,7 @@ void EscapeTransliterator::handleTransliterate(Replaceable& text, UTransPosition
|
|||
if ((c & 0xFFFF0000) != 0 && supplementalHandler != NULL) {
|
||||
buf.truncate(0);
|
||||
buf.append(supplementalHandler->prefix);
|
||||
Utility::appendNumber(buf, c, supplementalHandler->radix,
|
||||
ICU_Utility::appendNumber(buf, c, supplementalHandler->radix,
|
||||
supplementalHandler->minDigits);
|
||||
buf.append(supplementalHandler->suffix);
|
||||
redoPrefix = TRUE;
|
||||
|
@ -149,7 +149,7 @@ void EscapeTransliterator::handleTransliterate(Replaceable& text, UTransPosition
|
|||
} else {
|
||||
buf.truncate(prefixLen);
|
||||
}
|
||||
Utility::appendNumber(buf, c, radix, minDigits);
|
||||
ICU_Utility::appendNumber(buf, c, radix, minDigits);
|
||||
buf.append(suffix);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,10 +89,10 @@ UnicodeString& Quantifier::toPattern(UnicodeString& result,
|
|||
return result.append((UChar)43); /*+*/
|
||||
}
|
||||
result.append((UChar)123); /*{*/
|
||||
Utility::appendNumber(result, minCount);
|
||||
ICU_Utility::appendNumber(result, minCount);
|
||||
result.append((UChar)44); /*,*/
|
||||
if (maxCount != MAX) {
|
||||
Utility::appendNumber(result, maxCount);
|
||||
ICU_Utility::appendNumber(result, maxCount);
|
||||
}
|
||||
result.append((UChar)125); /*}*/
|
||||
return result;
|
||||
|
|
|
@ -983,7 +983,7 @@ static const UChar PRAGMA_NFC_RULES[] = {0x7E,0x6E,0x66,0x63,0x20,0x72,0x75,0x6C
|
|||
*/
|
||||
UBool TransliteratorParser::resemblesPragma(const UnicodeString& rule, int32_t pos, int32_t limit) {
|
||||
// Must start with /use\s/i
|
||||
return Utility::parsePattern(rule, pos, limit, PRAGMA_USE, NULL) >= 0;
|
||||
return ICU_Utility::parsePattern(rule, pos, limit, PRAGMA_USE, NULL) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1008,25 +1008,25 @@ int32_t TransliteratorParser::parsePragma(const UnicodeString& rule, int32_t pos
|
|||
// use maximum backup 16;
|
||||
// use nfd rules;
|
||||
// use nfc rules;
|
||||
int p = Utility::parsePattern(rule, pos, limit, PRAGMA_VARIABLE_RANGE, array);
|
||||
int p = ICU_Utility::parsePattern(rule, pos, limit, PRAGMA_VARIABLE_RANGE, array);
|
||||
if (p >= 0) {
|
||||
setVariableRange(array[0], array[1]);
|
||||
return p;
|
||||
}
|
||||
|
||||
p = Utility::parsePattern(rule, pos, limit, PRAGMA_MAXIMUM_BACKUP, array);
|
||||
p = ICU_Utility::parsePattern(rule, pos, limit, PRAGMA_MAXIMUM_BACKUP, array);
|
||||
if (p >= 0) {
|
||||
pragmaMaximumBackup(array[0]);
|
||||
return p;
|
||||
}
|
||||
|
||||
p = Utility::parsePattern(rule, pos, limit, PRAGMA_NFD_RULES, NULL);
|
||||
p = ICU_Utility::parsePattern(rule, pos, limit, PRAGMA_NFD_RULES, NULL);
|
||||
if (p >= 0) {
|
||||
pragmaNormalizeRules(UNORM_NFD);
|
||||
return p;
|
||||
}
|
||||
|
||||
p = Utility::parsePattern(rule, pos, limit, PRAGMA_NFC_RULES, NULL);
|
||||
p = ICU_Utility::parsePattern(rule, pos, limit, PRAGMA_NFC_RULES, NULL);
|
||||
if (p >= 0) {
|
||||
pragmaNormalizeRules(UNORM_NFC);
|
||||
return p;
|
||||
|
|
|
@ -575,7 +575,7 @@ void TransliterationRule::appendToRule(UnicodeString& rule,
|
|||
// quotes. \u and \U are not recognized within quotes. The same
|
||||
// logic applies to literals, but literals are never escaped.
|
||||
if (isLiteral ||
|
||||
(escapeUnprintable && Utility::isUnprintable(c))) {
|
||||
(escapeUnprintable && ICU_Utility::isUnprintable(c))) {
|
||||
if (quoteBuf.length() > 0) {
|
||||
// We prefer backslash APOSTROPHE to double APOSTROPHE
|
||||
// (more readable, less similar to ") so if there are
|
||||
|
@ -610,7 +610,7 @@ void TransliterationRule::appendToRule(UnicodeString& rule,
|
|||
}
|
||||
}
|
||||
if (c != (UChar32)-1) {
|
||||
if (!escapeUnprintable || !Utility::escapeUnprintable(rule, c)) {
|
||||
if (!escapeUnprintable || !ICU_Utility::escapeUnprintable(rule, c)) {
|
||||
rule.append(c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1009,7 +1009,7 @@ UnicodeString& Transliterator::toRules(UnicodeString& rulesSource,
|
|||
UnicodeString id = getID();
|
||||
for (int32_t i=0; i<id.length();) {
|
||||
UChar32 c = id.char32At(i);
|
||||
if (!Utility::escapeUnprintable(rulesSource, c)) {
|
||||
if (!ICU_Utility::escapeUnprintable(rulesSource, c)) {
|
||||
rulesSource.append(c);
|
||||
}
|
||||
i += UTF_CHAR_LENGTH(c);
|
||||
|
|
|
@ -388,7 +388,7 @@ void UnicodeSet::_appendToPat(UnicodeString& buf, UChar32 c, UBool useHexEscape)
|
|||
if (useHexEscape) {
|
||||
// Use hex escape notation (\uxxxx or \Uxxxxxxxx) for anything
|
||||
// unprintable
|
||||
if (Utility::escapeUnprintable(buf, c)) {
|
||||
if (ICU_Utility::escapeUnprintable(buf, c)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ UnicodeString& UnicodeSet::_toPattern(UnicodeString& result,
|
|||
for (i=0; i<pat.length(); ) {
|
||||
UChar32 c = pat.char32At(i);
|
||||
i += UTF_CHAR_LENGTH(c);
|
||||
if (escapeUnprintable && Utility::isUnprintable(c)) {
|
||||
if (escapeUnprintable && ICU_Utility::isUnprintable(c)) {
|
||||
// If the unprintable character is preceded by an odd
|
||||
// number of backslashes, then it has been escaped.
|
||||
// Before unescaping it, we delete the final
|
||||
|
@ -448,7 +448,7 @@ UnicodeString& UnicodeSet::_toPattern(UnicodeString& result,
|
|||
if ((backslashCount % 2) == 1) {
|
||||
result.truncate(result.length() - 1);
|
||||
}
|
||||
Utility::escapeUnprintable(result, c);
|
||||
ICU_Utility::escapeUnprintable(result, c);
|
||||
backslashCount = 0;
|
||||
} else {
|
||||
result.append(c);
|
||||
|
|
|
@ -28,7 +28,7 @@ static const UChar DIGITS[] = {
|
|||
85,86,87,88,89,90
|
||||
};
|
||||
|
||||
UnicodeString& Utility::appendNumber(UnicodeString& result, int32_t n,
|
||||
UnicodeString& ICU_Utility::appendNumber(UnicodeString& result, int32_t n,
|
||||
int32_t radix, int32_t minDigits) {
|
||||
if (radix < 2 || radix > 36) {
|
||||
// Bogus radix
|
||||
|
@ -66,7 +66,7 @@ static const UChar HEX[16] = {48,49,50,51,52,53,54,55, // 0-7
|
|||
/**
|
||||
* Return true if the character is NOT printable ASCII.
|
||||
*/
|
||||
UBool Utility::isUnprintable(UChar32 c) {
|
||||
UBool ICU_Utility::isUnprintable(UChar32 c) {
|
||||
return !(c == 0x0A || (c >= 0x20 && c <= 0x7E));
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ UBool Utility::isUnprintable(UChar32 c) {
|
|||
* printable ASCII, then do nothing and return FALSE. Otherwise,
|
||||
* append the escaped notation and return TRUE.
|
||||
*/
|
||||
UBool Utility::escapeUnprintable(UnicodeString& result, UChar32 c) {
|
||||
UBool ICU_Utility::escapeUnprintable(UnicodeString& result, UChar32 c) {
|
||||
if (isUnprintable(c)) {
|
||||
result.append(BACKSLASH);
|
||||
if (c & ~0xFFFF) {
|
||||
|
@ -102,7 +102,7 @@ UBool Utility::escapeUnprintable(UnicodeString& result, UChar32 c) {
|
|||
* For example, in the string "abc'hide'h", the 'h' in "hide" will not be
|
||||
* found by a search for 'h'.
|
||||
*/
|
||||
int32_t Utility::quotedIndexOf(const UnicodeString& text,
|
||||
int32_t ICU_Utility::quotedIndexOf(const UnicodeString& text,
|
||||
int32_t start, int32_t limit,
|
||||
UChar charToFind) {
|
||||
for (int32_t i=start; i<limit; ++i) {
|
||||
|
@ -124,7 +124,7 @@ int32_t Utility::quotedIndexOf(const UnicodeString& text,
|
|||
* at pos. Return the index of the first non-white-space character
|
||||
* at or after pos, or str.length(), if there is none.
|
||||
*/
|
||||
int32_t Utility::skipWhitespace(const UnicodeString& str, int32_t pos) {
|
||||
int32_t ICU_Utility::skipWhitespace(const UnicodeString& str, int32_t pos) {
|
||||
while (pos < str.length()) {
|
||||
UChar32 c = str.char32At(pos);
|
||||
if (!u_isWhitespace(c)) {
|
||||
|
@ -154,7 +154,7 @@ int32_t Utility::skipWhitespace(const UnicodeString& str, int32_t pos) {
|
|||
* @return the position after the last character parsed, or -1 if
|
||||
* the parse failed
|
||||
*/
|
||||
int32_t Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_t limit,
|
||||
int32_t ICU_Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_t limit,
|
||||
const UnicodeString& pattern, int32_t* parsedInts) {
|
||||
// TODO Update this to handle surrogates
|
||||
int32_t p;
|
||||
|
@ -208,7 +208,7 @@ static const UChar ZERO_X[] = {48, 120, 0}; // "0x"
|
|||
* character to parse. On output, the character after the last
|
||||
* parsed character.
|
||||
*/
|
||||
int32_t Utility::parseInteger(const UnicodeString& rule, int32_t& pos, int32_t limit) {
|
||||
int32_t ICU_Utility::parseInteger(const UnicodeString& rule, int32_t& pos, int32_t limit) {
|
||||
int32_t count = 0;
|
||||
int32_t value = 0;
|
||||
int32_t p = pos;
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
#include "unicode/unistr.h"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// class Utility
|
||||
// i18n utility functions, scoped into the class Utility.
|
||||
// class ICU_Utility
|
||||
// i18n utility functions, scoped into the class ICU_Utility.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class Utility {
|
||||
class ICU_Utility {
|
||||
public:
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue