mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-6551 reduce use of common words in rename.
X-SVN-Rev: 24652
This commit is contained in:
parent
b4dda4cc2d
commit
2145eb11be
16 changed files with 144 additions and 143 deletions
|
@ -160,7 +160,6 @@
|
|||
#define res_getTableItemByKey res_getTableItemByKey_4_1
|
||||
#define res_load res_load_4_1
|
||||
#define res_unload res_unload_4_1
|
||||
#define transliterator_cleanup transliterator_cleanup_4_1
|
||||
#define triedict_swap triedict_swap_4_1
|
||||
#define u_UCharsToChars u_UCharsToChars_4_1
|
||||
#define u_austrcpy u_austrcpy_4_1
|
||||
|
@ -1346,6 +1345,7 @@
|
|||
#define utrans_transIncremental utrans_transIncremental_4_1
|
||||
#define utrans_transIncrementalUChars utrans_transIncrementalUChars_4_1
|
||||
#define utrans_transUChars utrans_transUChars_4_1
|
||||
#define utrans_transliterator_cleanup utrans_transliterator_cleanup_4_1
|
||||
#define utrans_unregister utrans_unregister_4_1
|
||||
#define utrans_unregisterID utrans_unregisterID_4_1
|
||||
#define utrie_clone utrie_clone_4_1
|
||||
|
@ -1460,6 +1460,7 @@
|
|||
#define ClassDefFormat1Table ClassDefFormat1Table_4_1
|
||||
#define ClassDefFormat2Table ClassDefFormat2Table_4_1
|
||||
#define ClassDefinitionTable ClassDefinitionTable_4_1
|
||||
#define ClockMath ClockMath_4_1
|
||||
#define CollationElementIterator CollationElementIterator_4_1
|
||||
#define CollationKey CollationKey_4_1
|
||||
#define CollationLocaleListEnumeration CollationLocaleListEnumeration_4_1
|
||||
|
@ -1500,7 +1501,6 @@
|
|||
#define DictionaryBreakEngine DictionaryBreakEngine_4_1
|
||||
#define DigitList DigitList_4_1
|
||||
#define DistanceInfo DistanceInfo_4_1
|
||||
#define Entry Entry_4_1
|
||||
#define EnumToOffset EnumToOffset_4_1
|
||||
#define EscapeTransliterator EscapeTransliterator_4_1
|
||||
#define EthiopicCalendar EthiopicCalendar_4_1
|
||||
|
@ -1594,7 +1594,6 @@
|
|||
#define MarkToBasePositioningSubtable MarkToBasePositioningSubtable_4_1
|
||||
#define MarkToLigaturePositioningSubtable MarkToLigaturePositioningSubtable_4_1
|
||||
#define MarkToMarkPositioningSubtable MarkToMarkPositioningSubtable_4_1
|
||||
#define Math Math_4_1
|
||||
#define Measure Measure_4_1
|
||||
#define MeasureFormat MeasureFormat_4_1
|
||||
#define MeasureUnit MeasureUnit_4_1
|
||||
|
@ -1701,7 +1700,6 @@
|
|||
#define SingleSubstitutionFormat2Subtable SingleSubstitutionFormat2Subtable_4_1
|
||||
#define SingleSubstitutionSubtable SingleSubstitutionSubtable_4_1
|
||||
#define SingleTableProcessor SingleTableProcessor_4_1
|
||||
#define Spec Spec_4_1
|
||||
#define StateTableProcessor StateTableProcessor_4_1
|
||||
#define StringCharacterIterator StringCharacterIterator_4_1
|
||||
#define StringEnumeration StringEnumeration_4_1
|
||||
|
@ -1739,9 +1737,11 @@
|
|||
#define TransliterationRuleSet TransliterationRuleSet_4_1
|
||||
#define Transliterator Transliterator_4_1
|
||||
#define TransliteratorAlias TransliteratorAlias_4_1
|
||||
#define TransliteratorEntry TransliteratorEntry_4_1
|
||||
#define TransliteratorIDParser TransliteratorIDParser_4_1
|
||||
#define TransliteratorParser TransliteratorParser_4_1
|
||||
#define TransliteratorRegistry TransliteratorRegistry_4_1
|
||||
#define TransliteratorSpec TransliteratorSpec_4_1
|
||||
#define TrieWordDictionary TrieWordDictionary_4_1
|
||||
#define TrimmedArrayProcessor TrimmedArrayProcessor_4_1
|
||||
#define UCharCharacterIterator UCharCharacterIterator_4_1
|
||||
|
|
|
@ -207,7 +207,7 @@ const double CalendarAstronomer::PI = 3.14159265358979323846;
|
|||
* The modulus operator.
|
||||
*/
|
||||
inline static double normalize(double value, double range) {
|
||||
return value - range * Math::floorDivide(value, range);
|
||||
return value - range * ClockMath::floorDivide(value, range);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -417,7 +417,7 @@ double CalendarAstronomer::lstToUT(double lst) {
|
|||
double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24);
|
||||
|
||||
// Then find local midnight on this day
|
||||
double base = (DAY_MS * Math::floorDivide(fTime + fGmtOffset,(double)DAY_MS)) - fGmtOffset;
|
||||
double base = (DAY_MS * ClockMath::floorDivide(fTime + fGmtOffset,(double)DAY_MS)) - fGmtOffset;
|
||||
|
||||
//out(" lt =" + lt + " hours");
|
||||
//out(" base=" + new Date(base));
|
||||
|
@ -742,7 +742,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
|
|||
UDate t0 = fTime;
|
||||
|
||||
// Make a rough guess: 6am or 6pm local time on the current day
|
||||
double noon = Math::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS);
|
||||
double noon = ClockMath::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS);
|
||||
|
||||
U_DEBUG_ASTRO_MSG(("Noon=%.2lf, %sL, gmtoff %.2lf\n", noon, debug_astro_date(noon+fGmtOffset), fGmtOffset));
|
||||
setTime(noon + ((rise ? -6 : 6) * HOUR_MS));
|
||||
|
|
|
@ -1156,7 +1156,7 @@ void Calendar::computeFields(UErrorCode &ec)
|
|||
// JULIAN_DAY field and also removes some inelegant code. - Liu
|
||||
// 11/6/00
|
||||
|
||||
int32_t days = (int32_t)Math::floorDivide(localMillis, (double)kOneDay);
|
||||
int32_t days = (int32_t)ClockMath::floorDivide(localMillis, (double)kOneDay);
|
||||
|
||||
internalSet(UCAL_JULIAN_DAY,days + kEpochStartAsJulianDay);
|
||||
|
||||
|
@ -2349,7 +2349,7 @@ void Calendar::computeTime(UErrorCode& status) {
|
|||
double millis = Grego::julianDayToMillis(julianDay);
|
||||
|
||||
#if defined (U_DEBUG_CAL)
|
||||
// int32_t julianInsanityCheck = (int32_t)Math::floorDivide(millis, kOneDay);
|
||||
// int32_t julianInsanityCheck = (int32_t)ClockMath::floorDivide(millis, kOneDay);
|
||||
// julianInsanityCheck += kEpochStartAsJulianDay;
|
||||
// if(1 || julianInsanityCheck != julianDay) {
|
||||
// fprintf(stderr, "%s:%d- D'oh- computed jules %d, to mills (%s)%.lf, recomputed %d\n",
|
||||
|
|
|
@ -112,7 +112,7 @@ CECalendar::ceToJD(int32_t year, int32_t month, int32_t date, int32_t jdEpochOff
|
|||
return (int32_t) (
|
||||
(jdEpochOffset+365) // difference from Julian epoch to 1,1,1
|
||||
+ 365 * (year - 1) // number of days from years
|
||||
+ Math::floorDivide(year, 4) // extra day of leap year
|
||||
+ ClockMath::floorDivide(year, 4) // extra day of leap year
|
||||
+ 30 * (month + 1) // number of days from months
|
||||
+ date // number of days for present month
|
||||
- 31 // slack?
|
||||
|
@ -125,7 +125,7 @@ CECalendar::jdToCE(int32_t julianDay, int32_t jdEpochOffset, int32_t& year, int3
|
|||
int32_t c4; // number of 4 year cycle (1461 days)
|
||||
int32_t r4; // remainder of 4 year cycle, always positive
|
||||
|
||||
c4 = Math::floorDivide(julianDay - jdEpochOffset, 1461, r4);
|
||||
c4 = ClockMath::floorDivide(julianDay - jdEpochOffset, 1461, r4);
|
||||
|
||||
year = 4 * c4 + (r4/365 - r4/1460); // 4 * <number of 4year cycle> + <years within the last cycle>
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ int32_t ChineseCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, U
|
|||
// modify the extended year value accordingly.
|
||||
if (month < 0 || month > 11) {
|
||||
double m = month;
|
||||
eyear += (int32_t)Math::floorDivide(m, 12.0, m);
|
||||
eyear += (int32_t)ClockMath::floorDivide(m, 12.0, m);
|
||||
month = (int32_t)m;
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ double ChineseCalendar::daysToMillis(double days) {
|
|||
* @return days after January 1, 1970 0:00 Asia/Shanghai
|
||||
*/
|
||||
double ChineseCalendar::millisToDays(double millis) {
|
||||
return Math::floorDivide(millis + CHINA_OFFSET, kOneDay);
|
||||
return ClockMath::floorDivide(millis + CHINA_OFFSET, kOneDay);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
@ -662,7 +662,7 @@ void ChineseCalendar::computeChineseFields(int32_t days, int32_t gyear, int32_t
|
|||
|
||||
// 0->0,60 1->1,1 60->1,60 61->2,1 etc.
|
||||
int32_t yearOfCycle;
|
||||
int32_t cycle = Math::floorDivide(year - 1, 60, yearOfCycle);
|
||||
int32_t cycle = ClockMath::floorDivide(year - 1, 60, yearOfCycle);
|
||||
internalSet(UCAL_ERA, cycle + 1);
|
||||
internalSet(UCAL_YEAR, yearOfCycle + 1);
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
|
|||
// normalized cutover is in pure date milliseconds; it contains no time
|
||||
// of day or timezone component, and it used to compare against other
|
||||
// pure date values.
|
||||
int32_t cutoverDay = (int32_t)Math::floorDivide(fGregorianCutover, (double)kOneDay);
|
||||
int32_t cutoverDay = (int32_t)ClockMath::floorDivide(fGregorianCutover, (double)kOneDay);
|
||||
fNormalizedGregorianCutover = cutoverDay * kOneDay;
|
||||
|
||||
// Handle the rare case of numeric overflow. If the user specifies a
|
||||
|
@ -386,10 +386,10 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
|
|||
// The Julian epoch day (not the same as Julian Day)
|
||||
// is zero on Saturday December 30, 0 (Gregorian).
|
||||
int32_t julianEpochDay = julianDay - (kJan1_1JulianDay - 2);
|
||||
eyear = (int32_t) Math::floorDivide(4*julianEpochDay + 1464, 1461);
|
||||
eyear = (int32_t) ClockMath::floorDivide(4*julianEpochDay + 1464, 1461);
|
||||
|
||||
// Compute the Julian calendar day number for January 1, eyear
|
||||
int32_t january1 = 365*(eyear-1) + Math::floorDivide(eyear-1, (int32_t)4);
|
||||
int32_t january1 = 365*(eyear-1) + ClockMath::floorDivide(eyear-1, (int32_t)4);
|
||||
dayOfYear = (julianEpochDay - january1); // 0-based
|
||||
|
||||
// Julian leap years occurred historically every 4 years starting
|
||||
|
@ -535,12 +535,12 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month,
|
|||
// If the month is out of range, adjust it into range, and
|
||||
// modify the extended year value accordingly.
|
||||
if (month < 0 || month > 11) {
|
||||
eyear += Math::floorDivide(month, 12, month);
|
||||
eyear += ClockMath::floorDivide(month, 12, month);
|
||||
}
|
||||
|
||||
UBool isLeap = eyear%4 == 0;
|
||||
int32_t y = eyear-1;
|
||||
int32_t julianDay = 365*y + Math::floorDivide(y, 4) + (kJan1_1JulianDay - 3);
|
||||
int32_t julianDay = 365*y + ClockMath::floorDivide(y, 4) + (kJan1_1JulianDay - 3);
|
||||
|
||||
nonConstThis->fIsGregorian = (eyear >= fGregorianCutoverYear);
|
||||
#if defined (U_DEBUG_CAL)
|
||||
|
@ -578,7 +578,7 @@ int32_t GregorianCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mo
|
|||
// If the month is out of range, adjust it into range, and
|
||||
// modify the extended year value accordingly.
|
||||
if (month < 0 || month > 11) {
|
||||
extendedYear += Math::floorDivide(month, 12, month);
|
||||
extendedYear += ClockMath::floorDivide(month, 12, month);
|
||||
}
|
||||
|
||||
return isLeapYear(extendedYear) ? kLeapMonthLength[month] : kMonthLength[month];
|
||||
|
@ -697,7 +697,7 @@ GregorianCalendar::getEpochDay(UErrorCode& status)
|
|||
// dealing with UDate(Long.MIN_VALUE) and UDate(Long.MAX_VALUE).
|
||||
double wallSec = internalGetTime()/1000 + (internalGet(UCAL_ZONE_OFFSET) + internalGet(UCAL_DST_OFFSET))/1000;
|
||||
|
||||
return Math::floorDivide(wallSec, kOneDay/1000.0);
|
||||
return ClockMath::floorDivide(wallSec, kOneDay/1000.0);
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -716,7 +716,7 @@ double GregorianCalendar::computeJulianDayOfYear(UBool isGregorian,
|
|||
{
|
||||
isLeap = year%4 == 0;
|
||||
int32_t y = year - 1;
|
||||
double julianDay = 365.0*y + Math::floorDivide(y, 4) + (kJan1_1JulianDay - 3);
|
||||
double julianDay = 365.0*y + ClockMath::floorDivide(y, 4) + (kJan1_1JulianDay - 3);
|
||||
|
||||
if (isGregorian) {
|
||||
isLeap = isLeap && ((year%100 != 0) || (year%400 == 0));
|
||||
|
@ -785,7 +785,7 @@ double GregorianCalendar::computeJulianDayOfYear(UBool isGregorian,
|
|||
double
|
||||
GregorianCalendar::millisToJulianDay(UDate millis)
|
||||
{
|
||||
return (double)kEpochStartAsJulianDay + Math::floorDivide(millis, (double)kOneDay);
|
||||
return (double)kEpochStartAsJulianDay + ClockMath::floorDivide(millis, (double)kOneDay);
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2003-2007, International Business Machines
|
||||
* Copyright (c) 2003-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
|
@ -24,12 +24,12 @@
|
|||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
int32_t Math::floorDivide(int32_t numerator, int32_t denominator) {
|
||||
int32_t ClockMath::floorDivide(int32_t numerator, int32_t denominator) {
|
||||
return (numerator >= 0) ?
|
||||
numerator / denominator : ((numerator + 1) / denominator) - 1;
|
||||
}
|
||||
|
||||
int32_t Math::floorDivide(double numerator, int32_t denominator,
|
||||
int32_t ClockMath::floorDivide(double numerator, int32_t denominator,
|
||||
int32_t& remainder) {
|
||||
double quotient;
|
||||
quotient = uprv_floor(numerator / denominator);
|
||||
|
@ -37,7 +37,7 @@ int32_t Math::floorDivide(double numerator, int32_t denominator,
|
|||
return (int32_t) quotient;
|
||||
}
|
||||
|
||||
double Math::floorDivide(double dividend, double divisor,
|
||||
double ClockMath::floorDivide(double dividend, double divisor,
|
||||
double& remainder) {
|
||||
// Only designed to work for positive divisors
|
||||
U_ASSERT(divisor > 0);
|
||||
|
@ -86,8 +86,8 @@ double Grego::fieldsToDay(int32_t year, int32_t month, int32_t dom) {
|
|||
|
||||
int32_t y = year - 1;
|
||||
|
||||
double julian = 365 * y + Math::floorDivide(y, 4) + (JULIAN_1_CE - 3) + // Julian cal
|
||||
Math::floorDivide(y, 400) - Math::floorDivide(y, 100) + 2 + // => Gregorian cal
|
||||
double julian = 365 * y + ClockMath::floorDivide(y, 4) + (JULIAN_1_CE - 3) + // Julian cal
|
||||
ClockMath::floorDivide(y, 400) - ClockMath::floorDivide(y, 100) + 2 + // => Gregorian cal
|
||||
DAYS_BEFORE[month + (isLeapYear(year) ? 12 : 0)] + dom; // => month/dom
|
||||
|
||||
return julian - JULIAN_1970_CE; // JD => epoch day
|
||||
|
@ -103,10 +103,10 @@ void Grego::dayToFields(double day, int32_t& year, int32_t& month,
|
|||
// representation. We use 400-year, 100-year, and 4-year cycles.
|
||||
// For example, the 4-year cycle has 4 years + 1 leap day; giving
|
||||
// 1461 == 365*4 + 1 days.
|
||||
int32_t n400 = Math::floorDivide(day, 146097, doy); // 400-year cycle length
|
||||
int32_t n100 = Math::floorDivide(doy, 36524, doy); // 100-year cycle length
|
||||
int32_t n4 = Math::floorDivide(doy, 1461, doy); // 4-year cycle length
|
||||
int32_t n1 = Math::floorDivide(doy, 365, doy);
|
||||
int32_t n400 = ClockMath::floorDivide(day, 146097, doy); // 400-year cycle length
|
||||
int32_t n100 = ClockMath::floorDivide(doy, 36524, doy); // 100-year cycle length
|
||||
int32_t n4 = ClockMath::floorDivide(doy, 1461, doy); // 4-year cycle length
|
||||
int32_t n1 = ClockMath::floorDivide(doy, 365, doy);
|
||||
year = 400*n400 + 100*n100 + 4*n4 + n1;
|
||||
if (n100 == 4 || n1 == 4) {
|
||||
doy = 365; // Dec 31 at end of 4- or 400-year cycle
|
||||
|
@ -134,14 +134,14 @@ void Grego::dayToFields(double day, int32_t& year, int32_t& month,
|
|||
void Grego::timeToFields(UDate time, int32_t& year, int32_t& month,
|
||||
int32_t& dom, int32_t& dow, int32_t& doy, int32_t& mid) {
|
||||
double millisInDay;
|
||||
double day = Math::floorDivide((double)time, (double)U_MILLIS_PER_DAY, millisInDay);
|
||||
double day = ClockMath::floorDivide((double)time, (double)U_MILLIS_PER_DAY, millisInDay);
|
||||
mid = (int32_t)millisInDay;
|
||||
dayToFields(day, year, month, dom, dow, doy);
|
||||
}
|
||||
|
||||
int32_t Grego::dayOfWeek(double day) {
|
||||
int32_t dow;
|
||||
Math::floorDivide(day + UCAL_THURSDAY, 7, dow);
|
||||
ClockMath::floorDivide(day + UCAL_THURSDAY, 7, dow);
|
||||
return (dow == 0) ? UCAL_SATURDAY : dow;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2003-2007, International Business Machines
|
||||
* Copyright (c) 2003-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
|
@ -22,9 +22,10 @@ U_NAMESPACE_BEGIN
|
|||
|
||||
/**
|
||||
* A utility class providing mathematical functions used by time zone
|
||||
* and calendar code. Do not instantiate.
|
||||
* and calendar code. Do not instantiate. Formerly just named 'Math'.
|
||||
* @internal
|
||||
*/
|
||||
class Math {
|
||||
class ClockMath {
|
||||
public:
|
||||
/**
|
||||
* Divide two integers, returning the floor of the quotient.
|
||||
|
@ -250,7 +251,7 @@ class Grego {
|
|||
static const int8_t MONTH_LENGTH[24];
|
||||
};
|
||||
|
||||
inline double Math::floorDivide(double numerator, double denominator) {
|
||||
inline double ClockMath::floorDivide(double numerator, double denominator) {
|
||||
return uprv_floor(numerator / denominator);
|
||||
}
|
||||
|
||||
|
@ -281,12 +282,12 @@ inline double Grego::julianDayToMillis(int32_t julian)
|
|||
}
|
||||
|
||||
inline int32_t Grego::millisToJulianDay(double millis) {
|
||||
return (int32_t) (kEpochStartAsJulianDay + Math::floorDivide(millis, (double)kOneDay));
|
||||
return (int32_t) (kEpochStartAsJulianDay + ClockMath::floorDivide(millis, (double)kOneDay));
|
||||
}
|
||||
|
||||
inline int32_t Grego::gregorianShift(int32_t eyear) {
|
||||
int32_t y = eyear-1;
|
||||
int32_t gregShift = Math::floorDivide(y, 400) - Math::floorDivide(y, 100) + 2;
|
||||
int32_t gregShift = ClockMath::floorDivide(y, 400) - ClockMath::floorDivide(y, 100) + 2;
|
||||
return gregShift;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ static UBool isGregorianLeap(int32_t year)
|
|||
*/
|
||||
int32_t IndianCalendar::handleGetMonthLength(int32_t eyear, int32_t month) const {
|
||||
if (month < 0 || month > 11) {
|
||||
eyear += Math::floorDivide(month, 12, month);
|
||||
eyear += ClockMath::floorDivide(month, 12, month);
|
||||
}
|
||||
|
||||
if (isGregorianLeap(eyear + INDIAN_ERA_START) && month == 0) {
|
||||
|
@ -244,7 +244,7 @@ int32_t IndianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, UB
|
|||
|
||||
// If the month is out of range, adjust it into range, and adjust the extended eyar accordingly
|
||||
if (month < 0 || month > 11) {
|
||||
eyear += (int32_t)Math::floorDivide(month, 12, month);
|
||||
eyear += (int32_t)ClockMath::floorDivide(month, 12, month);
|
||||
}
|
||||
|
||||
if(month == 12){
|
||||
|
|
|
@ -194,7 +194,7 @@ UBool IslamicCalendar::civilLeapYear(int32_t year)
|
|||
*/
|
||||
int32_t IslamicCalendar::yearStart(int32_t year) {
|
||||
if (civil == CIVIL) {
|
||||
return (year-1)*354 + Math::floorDivide((3+11*year),30);
|
||||
return (year-1)*354 + ClockMath::floorDivide((3+11*year),30);
|
||||
} else {
|
||||
return trueMonthStart(12*(year-1));
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ int32_t IslamicCalendar::yearStart(int32_t year) {
|
|||
int32_t IslamicCalendar::monthStart(int32_t year, int32_t month) const {
|
||||
if (civil == CIVIL) {
|
||||
return (int32_t)uprv_ceil(29.5*month)
|
||||
+ (year-1)*354 + (int32_t)Math::floorDivide((3+11*year),30);
|
||||
+ (year-1)*354 + (int32_t)ClockMath::floorDivide((3+11*year),30);
|
||||
} else {
|
||||
return trueMonthStart(12*(year-1) + month);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ int32_t IslamicCalendar::trueMonthStart(int32_t month) const
|
|||
}
|
||||
} while (age < 0);
|
||||
}
|
||||
start = (int32_t)Math::floorDivide((origin - HIJRA_MILLIS), (double)kOneDay) + 1;
|
||||
start = (int32_t)ClockMath::floorDivide((origin - HIJRA_MILLIS), (double)kOneDay) + 1;
|
||||
CalendarCache::put(&gMonthCache, month, start, status);
|
||||
}
|
||||
trueMonthStartEnd :
|
||||
|
@ -397,7 +397,7 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
|
|||
|
||||
if (civil == CIVIL) {
|
||||
// Use the civil calendar approximation, which is just arithmetic
|
||||
year = (int)Math::floorDivide( (double)(30 * days + 10646) , 10631.0 );
|
||||
year = (int)ClockMath::floorDivide( (double)(30 * days + 10646) , 10631.0 );
|
||||
month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 );
|
||||
month = month<11?month:11;
|
||||
startDate = monthStart(year, month);
|
||||
|
|
|
@ -138,7 +138,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
|
|||
for(jj=0;jj<transitionCount;jj++) {
|
||||
int32_t year, month, dom, dow;
|
||||
double millis=0;
|
||||
double days = Math::floorDivide(((double)transitionTimes[jj])*1000.0, (double)U_MILLIS_PER_DAY, millis);
|
||||
double days = ClockMath::floorDivide(((double)transitionTimes[jj])*1000.0, (double)U_MILLIS_PER_DAY, millis);
|
||||
|
||||
Grego::dayToFields(days, year, month, dom, dow);
|
||||
U_DEBUG_TZ_MSG((" Transition %d: time %d (%04d.%02d.%02d+%.1fh), typedata%d\n", jj, transitionTimes[jj],
|
||||
|
@ -385,7 +385,7 @@ int32_t OlsonTimeZone::getRawOffset() const {
|
|||
void printTime(double ms) {
|
||||
int32_t year, month, dom, dow;
|
||||
double millis=0;
|
||||
double days = Math::floorDivide(((double)ms), (double)U_MILLIS_PER_DAY, millis);
|
||||
double days = ClockMath::floorDivide(((double)ms), (double)U_MILLIS_PER_DAY, millis);
|
||||
|
||||
Grego::dayToFields(days, year, month, dom, dow);
|
||||
U_DEBUG_TZ_MSG((" getHistoricalOffset: time %.1f (%04d.%02d.%02d+%.1fh)\n", ms,
|
||||
|
@ -505,7 +505,7 @@ UBool OlsonTimeZone::useDaylightTime() const {
|
|||
// DST is in use in the current year (at any point in the year)
|
||||
// and returns TRUE if so.
|
||||
|
||||
int32_t days = (int32_t)Math::floorDivide(uprv_getUTCtime(), (double)U_MILLIS_PER_DAY); // epoch days
|
||||
int32_t days = (int32_t)ClockMath::floorDivide(uprv_getUTCtime(), (double)U_MILLIS_PER_DAY); // epoch days
|
||||
|
||||
int32_t year, month, dom, dow;
|
||||
|
||||
|
|
|
@ -1631,7 +1631,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
|
|||
_registerSpecialInverse(UNICODE_STRING_SIMPLE("Title"),
|
||||
UNICODE_STRING_SIMPLE("Lower"), FALSE);
|
||||
|
||||
ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, transliterator_cleanup);
|
||||
ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, utrans_transliterator_cleanup);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ U_NAMESPACE_END
|
|||
* necessarily invalidate any rule-based transliterators held by the
|
||||
* user, because RBTs hold pointers to common data objects.
|
||||
*/
|
||||
U_CFUNC UBool transliterator_cleanup(void) {
|
||||
U_CFUNC UBool utrans_transliterator_cleanup(void) {
|
||||
U_NAMESPACE_USE
|
||||
TransliteratorIDParser::cleanup();
|
||||
if (registry) {
|
||||
|
|
|
@ -185,11 +185,11 @@ void TransliteratorAlias::parse(TransliteratorParser& parser,
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Spec
|
||||
// class TransliteratorSpec
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A Spec is a string specifying either a source or a target. In more
|
||||
* A TransliteratorSpec is a string specifying either a source or a target. In more
|
||||
* general terms, it may also specify a variant, but we only use the
|
||||
* Spec class for sources and targets.
|
||||
*
|
||||
|
@ -203,10 +203,10 @@ void TransliteratorAlias::parse(TransliteratorParser& parser,
|
|||
* canonical form, or the script is transformed from an abbreviation
|
||||
* to a full name.
|
||||
*/
|
||||
class Spec : public UMemory {
|
||||
class TransliteratorSpec : public UMemory {
|
||||
public:
|
||||
Spec(const UnicodeString& spec);
|
||||
~Spec();
|
||||
TransliteratorSpec(const UnicodeString& spec);
|
||||
~TransliteratorSpec();
|
||||
|
||||
const UnicodeString& get() const;
|
||||
UBool hasFallback() const;
|
||||
|
@ -230,11 +230,11 @@ class Spec : public UMemory {
|
|||
UBool isNextLocale; // TRUE if nextSpec is a locale
|
||||
ResourceBundle* res;
|
||||
|
||||
Spec(const Spec &other); // forbid copying of this class
|
||||
Spec &operator=(const Spec &other); // forbid copying of this class
|
||||
TransliteratorSpec(const TransliteratorSpec &other); // forbid copying of this class
|
||||
TransliteratorSpec &operator=(const TransliteratorSpec &other); // forbid copying of this class
|
||||
};
|
||||
|
||||
Spec::Spec(const UnicodeString& theSpec)
|
||||
TransliteratorSpec::TransliteratorSpec(const UnicodeString& theSpec)
|
||||
: top(theSpec),
|
||||
res(0)
|
||||
{
|
||||
|
@ -280,15 +280,15 @@ Spec::Spec(const UnicodeString& theSpec)
|
|||
reset();
|
||||
}
|
||||
|
||||
Spec::~Spec() {
|
||||
TransliteratorSpec::~TransliteratorSpec() {
|
||||
delete res;
|
||||
}
|
||||
|
||||
UBool Spec::hasFallback() const {
|
||||
UBool TransliteratorSpec::hasFallback() const {
|
||||
return nextSpec.length() != 0;
|
||||
}
|
||||
|
||||
void Spec::reset() {
|
||||
void TransliteratorSpec::reset() {
|
||||
if (spec != top) {
|
||||
spec = top;
|
||||
isSpecLocale = (res != 0);
|
||||
|
@ -296,7 +296,7 @@ void Spec::reset() {
|
|||
}
|
||||
}
|
||||
|
||||
void Spec::setupNext() {
|
||||
void TransliteratorSpec::setupNext() {
|
||||
isNextLocale = FALSE;
|
||||
if (isSpecLocale) {
|
||||
nextSpec = spec;
|
||||
|
@ -319,22 +319,22 @@ void Spec::setupNext() {
|
|||
// for(const UnicodeString& s(spec.get());
|
||||
// spec.hasFallback(); s(spec.next())) { ...
|
||||
|
||||
const UnicodeString& Spec::next() {
|
||||
const UnicodeString& TransliteratorSpec::next() {
|
||||
spec = nextSpec;
|
||||
isSpecLocale = isNextLocale;
|
||||
setupNext();
|
||||
return spec;
|
||||
}
|
||||
|
||||
const UnicodeString& Spec::get() const {
|
||||
const UnicodeString& TransliteratorSpec::get() const {
|
||||
return spec;
|
||||
}
|
||||
|
||||
UBool Spec::isLocale() const {
|
||||
UBool TransliteratorSpec::isLocale() const {
|
||||
return isSpecLocale;
|
||||
}
|
||||
|
||||
ResourceBundle& Spec::getBundle() const {
|
||||
ResourceBundle& TransliteratorSpec::getBundle() const {
|
||||
return *res;
|
||||
}
|
||||
|
||||
|
@ -354,9 +354,9 @@ static void DEBUG_setup() {
|
|||
|
||||
// Caller must call DEBUG_setup first. Return index of given Entry,
|
||||
// if it is in use (not deleted yet), or -1 if not found.
|
||||
static int DEBUG_findEntry(Entry* e) {
|
||||
static int DEBUG_findEntry(TransliteratorEntry* e) {
|
||||
for (int i=0; i<DEBUG_entries->size(); ++i) {
|
||||
if (e == (Entry*) DEBUG_entries->elementAt(i)) {
|
||||
if (e == (TransliteratorEntry*) DEBUG_entries->elementAt(i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ static int DEBUG_findEntry(Entry* e) {
|
|||
}
|
||||
|
||||
// Track object creation
|
||||
static void DEBUG_newEntry(Entry* e) {
|
||||
static void DEBUG_newEntry(TransliteratorEntry* e) {
|
||||
DEBUG_setup();
|
||||
if (DEBUG_findEntry(e) >= 0) {
|
||||
// This should really never happen unless the heap is broken
|
||||
|
@ -376,7 +376,7 @@ static void DEBUG_newEntry(Entry* e) {
|
|||
}
|
||||
|
||||
// Track object deletion
|
||||
static void DEBUG_delEntry(Entry* e) {
|
||||
static void DEBUG_delEntry(TransliteratorEntry* e) {
|
||||
DEBUG_setup();
|
||||
int i = DEBUG_findEntry(e);
|
||||
if (i < 0) {
|
||||
|
@ -387,7 +387,7 @@ static void DEBUG_delEntry(Entry* e) {
|
|||
}
|
||||
|
||||
// Track object usage
|
||||
static void DEBUG_useEntry(Entry* e) {
|
||||
static void DEBUG_useEntry(TransliteratorEntry* e) {
|
||||
if (e == NULL) return;
|
||||
DEBUG_setup();
|
||||
int i = DEBUG_findEntry(e);
|
||||
|
@ -417,7 +417,7 @@ static void DEBUG_useEntry(Entry* e) {
|
|||
* for it. We could easily add this if there is a need for it in the
|
||||
* future.
|
||||
*/
|
||||
class Entry : public UMemory {
|
||||
class TransliteratorEntry : public UMemory {
|
||||
public:
|
||||
enum Type {
|
||||
RULES_FORWARD,
|
||||
|
@ -444,26 +444,26 @@ public:
|
|||
Transliterator::Token context;
|
||||
} factory; // For FACTORY
|
||||
} u;
|
||||
Entry();
|
||||
~Entry();
|
||||
TransliteratorEntry();
|
||||
~TransliteratorEntry();
|
||||
void adoptPrototype(Transliterator* adopted);
|
||||
void setFactory(Transliterator::Factory factory,
|
||||
Transliterator::Token context);
|
||||
|
||||
private:
|
||||
|
||||
Entry(const Entry &other); // forbid copying of this class
|
||||
Entry &operator=(const Entry &other); // forbid copying of this class
|
||||
TransliteratorEntry(const TransliteratorEntry &other); // forbid copying of this class
|
||||
TransliteratorEntry &operator=(const TransliteratorEntry &other); // forbid copying of this class
|
||||
};
|
||||
|
||||
Entry::Entry() {
|
||||
TransliteratorEntry::TransliteratorEntry() {
|
||||
u.prototype = 0;
|
||||
compoundFilter = NULL;
|
||||
entryType = NONE;
|
||||
DEBUG_newEntry(this);
|
||||
}
|
||||
|
||||
Entry::~Entry() {
|
||||
TransliteratorEntry::~TransliteratorEntry() {
|
||||
DEBUG_delEntry(this);
|
||||
if (entryType == PROTOTYPE) {
|
||||
delete u.prototype;
|
||||
|
@ -481,7 +481,7 @@ Entry::~Entry() {
|
|||
delete compoundFilter;
|
||||
}
|
||||
|
||||
void Entry::adoptPrototype(Transliterator* adopted) {
|
||||
void TransliteratorEntry::adoptPrototype(Transliterator* adopted) {
|
||||
if (entryType == PROTOTYPE) {
|
||||
delete u.prototype;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ void Entry::adoptPrototype(Transliterator* adopted) {
|
|||
u.prototype = adopted;
|
||||
}
|
||||
|
||||
void Entry::setFactory(Transliterator::Factory factory,
|
||||
void TransliteratorEntry::setFactory(Transliterator::Factory factory,
|
||||
Transliterator::Token context) {
|
||||
if (entryType == PROTOTYPE) {
|
||||
delete u.prototype;
|
||||
|
@ -503,7 +503,7 @@ void Entry::setFactory(Transliterator::Factory factory,
|
|||
U_CDECL_BEGIN
|
||||
static void U_CALLCONV
|
||||
deleteEntry(void* obj) {
|
||||
delete (Entry*) obj;
|
||||
delete (TransliteratorEntry*) obj;
|
||||
}
|
||||
U_CDECL_END
|
||||
|
||||
|
@ -530,7 +530,7 @@ Transliterator* TransliteratorRegistry::get(const UnicodeString& ID,
|
|||
TransliteratorAlias*& aliasReturn,
|
||||
UErrorCode& status) {
|
||||
U_ASSERT(aliasReturn == NULL);
|
||||
Entry *entry = find(ID);
|
||||
TransliteratorEntry *entry = find(ID);
|
||||
return (entry == 0) ? 0
|
||||
: instantiateEntry(ID, entry, aliasReturn, status);
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
|
|||
TransliteratorAlias*& aliasReturn,
|
||||
UErrorCode& status) {
|
||||
U_ASSERT(aliasReturn == NULL);
|
||||
Entry *entry = find(ID);
|
||||
TransliteratorEntry *entry = find(ID);
|
||||
|
||||
if (entry == 0) {
|
||||
// We get to this point if there are two threads, one of which
|
||||
|
@ -561,26 +561,26 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
|
|||
// We have to detect this so we don't stomp over existing entry
|
||||
// data members and potentially leak memory (u.data and compoundFilter).
|
||||
|
||||
if (entry->entryType == Entry::RULES_FORWARD ||
|
||||
entry->entryType == Entry::RULES_REVERSE ||
|
||||
entry->entryType == Entry::LOCALE_RULES) {
|
||||
if (entry->entryType == TransliteratorEntry::RULES_FORWARD ||
|
||||
entry->entryType == TransliteratorEntry::RULES_REVERSE ||
|
||||
entry->entryType == TransliteratorEntry::LOCALE_RULES) {
|
||||
|
||||
if (parser.idBlockVector.isEmpty() && parser.dataVector.isEmpty()) {
|
||||
entry->u.data = 0;
|
||||
entry->entryType = Entry::ALIAS;
|
||||
entry->entryType = TransliteratorEntry::ALIAS;
|
||||
entry->stringArg = UNICODE_STRING_SIMPLE("Any-NULL");
|
||||
}
|
||||
else if (parser.idBlockVector.isEmpty() && parser.dataVector.size() == 1) {
|
||||
entry->u.data = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0);
|
||||
entry->entryType = Entry::RBT_DATA;
|
||||
entry->entryType = TransliteratorEntry::RBT_DATA;
|
||||
}
|
||||
else if (parser.idBlockVector.size() == 1 && parser.dataVector.isEmpty()) {
|
||||
entry->stringArg = *(UnicodeString*)(parser.idBlockVector.elementAt(0));
|
||||
entry->compoundFilter = parser.orphanCompoundFilter();
|
||||
entry->entryType = Entry::ALIAS;
|
||||
entry->entryType = TransliteratorEntry::ALIAS;
|
||||
}
|
||||
else {
|
||||
entry->entryType = Entry::COMPOUND_RBT;
|
||||
entry->entryType = TransliteratorEntry::COMPOUND_RBT;
|
||||
entry->compoundFilter = parser.orphanCompoundFilter();
|
||||
entry->u.dataVector = new UVector(status);
|
||||
entry->stringArg.remove();
|
||||
|
@ -613,7 +613,7 @@ void TransliteratorRegistry::put(Transliterator* adoptedProto,
|
|||
UBool visible,
|
||||
UErrorCode& ec)
|
||||
{
|
||||
Entry *entry = new Entry();
|
||||
TransliteratorEntry *entry = new TransliteratorEntry();
|
||||
if (entry == NULL) {
|
||||
ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -627,7 +627,7 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
|
|||
Transliterator::Token context,
|
||||
UBool visible,
|
||||
UErrorCode& ec) {
|
||||
Entry *entry = new Entry();
|
||||
TransliteratorEntry *entry = new TransliteratorEntry();
|
||||
if (entry == NULL) {
|
||||
ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -642,13 +642,13 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
|
|||
UBool readonlyResourceAlias,
|
||||
UBool visible,
|
||||
UErrorCode& ec) {
|
||||
Entry *entry = new Entry();
|
||||
TransliteratorEntry *entry = new TransliteratorEntry();
|
||||
if (entry == NULL) {
|
||||
ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
entry->entryType = (dir == UTRANS_FORWARD) ? Entry::RULES_FORWARD
|
||||
: Entry::RULES_REVERSE;
|
||||
entry->entryType = (dir == UTRANS_FORWARD) ? TransliteratorEntry::RULES_FORWARD
|
||||
: TransliteratorEntry::RULES_REVERSE;
|
||||
if (readonlyResourceAlias) {
|
||||
entry->stringArg.setTo(TRUE, resourceName.getBuffer(), -1);
|
||||
}
|
||||
|
@ -663,10 +663,10 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
|
|||
UBool readonlyAliasAlias,
|
||||
UBool visible,
|
||||
UErrorCode& /*ec*/) {
|
||||
Entry *entry = new Entry();
|
||||
TransliteratorEntry *entry = new TransliteratorEntry();
|
||||
// Null pointer check
|
||||
if (entry != NULL) {
|
||||
entry->entryType = Entry::ALIAS;
|
||||
entry->entryType = TransliteratorEntry::ALIAS;
|
||||
if (readonlyAliasAlias) {
|
||||
entry->stringArg.setTo(TRUE, alias.getBuffer(), -1);
|
||||
}
|
||||
|
@ -863,7 +863,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TransliteratorRegistry::Enumeration)
|
|||
void TransliteratorRegistry::registerEntry(const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
const UnicodeString& variant,
|
||||
Entry* adopted,
|
||||
TransliteratorEntry* adopted,
|
||||
UBool visible) {
|
||||
UnicodeString ID;
|
||||
UnicodeString s(source);
|
||||
|
@ -878,7 +878,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& source,
|
|||
* Convenience method. Calls 6-arg registerEntry().
|
||||
*/
|
||||
void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
|
||||
Entry* adopted,
|
||||
TransliteratorEntry* adopted,
|
||||
UBool visible) {
|
||||
UnicodeString source, target, variant;
|
||||
UBool sawSource;
|
||||
|
@ -897,7 +897,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
|
|||
const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
const UnicodeString& variant,
|
||||
Entry* adopted,
|
||||
TransliteratorEntry* adopted,
|
||||
UBool visible) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
registry.put(ID, adopted, status);
|
||||
|
@ -999,12 +999,12 @@ void TransliteratorRegistry::removeSTV(const UnicodeString& source,
|
|||
*
|
||||
* Caller does NOT own returned object.
|
||||
*/
|
||||
Entry* TransliteratorRegistry::findInDynamicStore(const Spec& src,
|
||||
const Spec& trg,
|
||||
TransliteratorEntry* TransliteratorRegistry::findInDynamicStore(const TransliteratorSpec& src,
|
||||
const TransliteratorSpec& trg,
|
||||
const UnicodeString& variant) const {
|
||||
UnicodeString ID;
|
||||
TransliteratorIDParser::STVtoID(src, trg, variant, ID);
|
||||
Entry *e = (Entry*) registry.get(ID);
|
||||
TransliteratorEntry *e = (TransliteratorEntry*) registry.get(ID);
|
||||
DEBUG_useEntry(e);
|
||||
return e;
|
||||
}
|
||||
|
@ -1020,10 +1020,10 @@ Entry* TransliteratorRegistry::findInDynamicStore(const Spec& src,
|
|||
*
|
||||
* Caller does NOT own returned object.
|
||||
*/
|
||||
Entry* TransliteratorRegistry::findInStaticStore(const Spec& src,
|
||||
const Spec& trg,
|
||||
TransliteratorEntry* TransliteratorRegistry::findInStaticStore(const TransliteratorSpec& src,
|
||||
const TransliteratorSpec& trg,
|
||||
const UnicodeString& variant) {
|
||||
Entry* entry = 0;
|
||||
TransliteratorEntry* entry = 0;
|
||||
if (src.isLocale()) {
|
||||
entry = findInBundle(src, trg, variant, UTRANS_FORWARD);
|
||||
} else if (trg.isLocale()) {
|
||||
|
@ -1056,8 +1056,8 @@ static const UChar TRANSLITERATE[] = {84,114,97,110,115,108,105,116,101,114,97,1
|
|||
* On success, create a new Entry object, populate it, and return it.
|
||||
* The caller owns the returned object.
|
||||
*/
|
||||
Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen,
|
||||
const Spec& specToFind,
|
||||
TransliteratorEntry* TransliteratorRegistry::findInBundle(const TransliteratorSpec& specToOpen,
|
||||
const TransliteratorSpec& specToFind,
|
||||
const UnicodeString& variant,
|
||||
UTransDirection direction)
|
||||
{
|
||||
|
@ -1120,7 +1120,7 @@ Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen,
|
|||
|
||||
// We have succeeded in loading a string from the locale
|
||||
// resources. Create a new registry entry to hold it and return it.
|
||||
Entry *entry = new Entry();
|
||||
TransliteratorEntry *entry = new TransliteratorEntry();
|
||||
if (entry != 0) {
|
||||
// The direction is always forward for the
|
||||
// TransliterateTo_xxx and TransliterateFrom_xxx
|
||||
|
@ -1129,7 +1129,7 @@ Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen,
|
|||
// the direction is the value passed in to this
|
||||
// function.
|
||||
int32_t dir = (pass == 0) ? UTRANS_FORWARD : direction;
|
||||
entry->entryType = Entry::LOCALE_RULES;
|
||||
entry->entryType = TransliteratorEntry::LOCALE_RULES;
|
||||
entry->stringArg = resStr;
|
||||
entry->intArg = dir;
|
||||
}
|
||||
|
@ -1140,7 +1140,7 @@ Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen,
|
|||
/**
|
||||
* Convenience method. Calls 3-arg find().
|
||||
*/
|
||||
Entry* TransliteratorRegistry::find(const UnicodeString& ID) {
|
||||
TransliteratorEntry* TransliteratorRegistry::find(const UnicodeString& ID) {
|
||||
UnicodeString source, target, variant;
|
||||
UBool sawSource;
|
||||
TransliteratorIDParser::IDtoSTV(ID, source, target, variant, sawSource);
|
||||
|
@ -1168,13 +1168,13 @@ Entry* TransliteratorRegistry::find(const UnicodeString& ID) {
|
|||
*
|
||||
* Caller does NOT own returned object. Return 0 on failure.
|
||||
*/
|
||||
Entry* TransliteratorRegistry::find(UnicodeString& source,
|
||||
TransliteratorEntry* TransliteratorRegistry::find(UnicodeString& source,
|
||||
UnicodeString& target,
|
||||
UnicodeString& variant) {
|
||||
|
||||
Spec src(source);
|
||||
Spec trg(target);
|
||||
Entry* entry;
|
||||
TransliteratorSpec src(source);
|
||||
TransliteratorSpec trg(target);
|
||||
TransliteratorEntry* entry;
|
||||
|
||||
if (variant.length() != 0) {
|
||||
|
||||
|
@ -1232,38 +1232,38 @@ Entry* TransliteratorRegistry::find(UnicodeString& source,
|
|||
* modified.
|
||||
*/
|
||||
Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID,
|
||||
Entry *entry,
|
||||
TransliteratorEntry *entry,
|
||||
TransliteratorAlias* &aliasReturn,
|
||||
UErrorCode& status) {
|
||||
Transliterator *t = 0;
|
||||
U_ASSERT(aliasReturn == 0);
|
||||
|
||||
switch (entry->entryType) {
|
||||
case Entry::RBT_DATA:
|
||||
case TransliteratorEntry::RBT_DATA:
|
||||
t = new RuleBasedTransliterator(ID, entry->u.data);
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return t;
|
||||
case Entry::PROTOTYPE:
|
||||
case TransliteratorEntry::PROTOTYPE:
|
||||
t = entry->u.prototype->clone();
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return t;
|
||||
case Entry::ALIAS:
|
||||
case TransliteratorEntry::ALIAS:
|
||||
aliasReturn = new TransliteratorAlias(entry->stringArg, entry->compoundFilter);
|
||||
if (aliasReturn == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return 0;
|
||||
case Entry::FACTORY:
|
||||
case TransliteratorEntry::FACTORY:
|
||||
t = entry->u.factory.function(ID, entry->u.factory.context);
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return t;
|
||||
case Entry::COMPOUND_RBT:
|
||||
case TransliteratorEntry::COMPOUND_RBT:
|
||||
{
|
||||
UVector* rbts = new UVector(entry->u.dataVector->size(), status);
|
||||
// Check for null pointer
|
||||
|
@ -1290,15 +1290,15 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
|
|||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return 0;
|
||||
case Entry::LOCALE_RULES:
|
||||
case TransliteratorEntry::LOCALE_RULES:
|
||||
aliasReturn = new TransliteratorAlias(ID, entry->stringArg,
|
||||
(UTransDirection) entry->intArg);
|
||||
if (aliasReturn == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return 0;
|
||||
case Entry::RULES_FORWARD:
|
||||
case Entry::RULES_REVERSE:
|
||||
case TransliteratorEntry::RULES_FORWARD:
|
||||
case TransliteratorEntry::RULES_REVERSE:
|
||||
// Process the rule data into a TransliteratorRuleData object,
|
||||
// and possibly also into an ::id header and/or footer. Then
|
||||
// we modify the registry with the parsed data and retry.
|
||||
|
@ -1330,7 +1330,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
|
|||
// transliterators; if it lists something that's not
|
||||
// installed, we'll get an error from ResourceBundle.
|
||||
aliasReturn = new TransliteratorAlias(ID, rules,
|
||||
((entry->entryType == Entry::RULES_REVERSE) ?
|
||||
((entry->entryType == TransliteratorEntry::RULES_REVERSE) ?
|
||||
UTRANS_REVERSE : UTRANS_FORWARD));
|
||||
if (aliasReturn == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class Entry;
|
||||
class Spec;
|
||||
class TransliteratorEntry;
|
||||
class TransliteratorSpec;
|
||||
class UnicodeString;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
@ -359,40 +359,40 @@ class TransliteratorRegistry : public UMemory {
|
|||
// Private implementation
|
||||
//----------------------------------------------------------------
|
||||
|
||||
Entry* find(const UnicodeString& ID);
|
||||
TransliteratorEntry* find(const UnicodeString& ID);
|
||||
|
||||
Entry* find(UnicodeString& source,
|
||||
TransliteratorEntry* find(UnicodeString& source,
|
||||
UnicodeString& target,
|
||||
UnicodeString& variant);
|
||||
|
||||
Entry* findInDynamicStore(const Spec& src,
|
||||
const Spec& trg,
|
||||
TransliteratorEntry* findInDynamicStore(const TransliteratorSpec& src,
|
||||
const TransliteratorSpec& trg,
|
||||
const UnicodeString& variant) const;
|
||||
|
||||
Entry* findInStaticStore(const Spec& src,
|
||||
const Spec& trg,
|
||||
TransliteratorEntry* findInStaticStore(const TransliteratorSpec& src,
|
||||
const TransliteratorSpec& trg,
|
||||
const UnicodeString& variant);
|
||||
|
||||
static Entry* findInBundle(const Spec& specToOpen,
|
||||
const Spec& specToFind,
|
||||
static TransliteratorEntry* findInBundle(const TransliteratorSpec& specToOpen,
|
||||
const TransliteratorSpec& specToFind,
|
||||
const UnicodeString& variant,
|
||||
UTransDirection direction);
|
||||
|
||||
void registerEntry(const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
const UnicodeString& variant,
|
||||
Entry* adopted,
|
||||
TransliteratorEntry* adopted,
|
||||
UBool visible);
|
||||
|
||||
void registerEntry(const UnicodeString& ID,
|
||||
Entry* adopted,
|
||||
TransliteratorEntry* adopted,
|
||||
UBool visible);
|
||||
|
||||
void registerEntry(const UnicodeString& ID,
|
||||
const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
const UnicodeString& variant,
|
||||
Entry* adopted,
|
||||
TransliteratorEntry* adopted,
|
||||
UBool visible);
|
||||
|
||||
void registerSTV(const UnicodeString& source,
|
||||
|
@ -404,7 +404,7 @@ class TransliteratorRegistry : public UMemory {
|
|||
const UnicodeString& variant);
|
||||
|
||||
Transliterator* instantiateEntry(const UnicodeString& ID,
|
||||
Entry *entry,
|
||||
TransliteratorEntry *entry,
|
||||
TransliteratorAlias*& aliasReturn,
|
||||
UErrorCode& status);
|
||||
|
||||
|
|
|
@ -920,7 +920,7 @@ void TransliteratorIDParser::init(UErrorCode &status) {
|
|||
umtx_unlock(&LOCK);
|
||||
delete special_inverses; /*null instance*/
|
||||
|
||||
ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, transliterator_cleanup);
|
||||
ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, utrans_transliterator_cleanup);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,6 @@ typedef enum ECleanupI18NType {
|
|||
U_CFUNC void U_EXPORT2 ucln_i18n_registerCleanup(ECleanupI18NType type,
|
||||
cleanupFunc *func);
|
||||
|
||||
U_CFUNC UBool transliterator_cleanup(void);
|
||||
U_CFUNC UBool utrans_transliterator_cleanup(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue