ICU-96 aligning old code with new ENUMs

X-SVN-Rev: 3125
This commit is contained in:
Vladimir Weinstein 2000-12-05 01:03:35 +00:00
parent d881a19435
commit e2db5e18bc
2 changed files with 22 additions and 9 deletions

View File

@ -2955,7 +2955,18 @@ UColAttributeValue RuleBasedCollator::getAttribute(UColAttribute attr, UErrorCod
status = U_UNSUPPORTED_ERROR;
break;
case UCOL_STRENGTH: /* attribute for strength */
status = U_UNSUPPORTED_ERROR;
switch(getStrength()) {
case PRIMARY :
return UCOL_PRIMARY;
case SECONDARY :
return UCOL_SECONDARY;
case TERTIARY :
return UCOL_TERTIARY;
case IDENTICAL :
return UCOL_IDENTICAL;
default :
status = U_INTERNAL_PROGRAM_ERROR;
}
break;
case UCOL_ATTRIBUTE_COUNT:
default:

View File

@ -666,13 +666,14 @@ U_CAPI UCollationResult ucol_strcollinc(const UCollator *coll,
return UCOL_EQUAL;
}
UColAttributeValue strength = ucol_getAttribute(coll, UCOL_STRENGTH, &status);
int32_t sOrder, tOrder;
uint32_t pSOrder, pTOrder;
UBool gets = TRUE, gett = TRUE;
UBool initialCheckSecTer = cppColl->getStrength() >= UCOL_SECONDARY;
UBool initialCheckSecTer = strength >= UCOL_SECONDARY;
UBool checkSecTer = initialCheckSecTer;
UBool checkTertiary = cppColl->getStrength() >= UCOL_TERTIARY;
UBool checkQuad = cppColl->getStrength() >= UCOL_QUATERNARY;
UBool checkTertiary = strength >= UCOL_TERTIARY;
UBool checkQuad = strength >= UCOL_QUATERNARY;
UBool isFrenchSec = (cppColl->getAttribute(UCOL_FRENCH_COLLATION, status) == UCOL_ON) && checkSecTer;
if(!isFrenchSec) {
@ -1076,7 +1077,7 @@ U_CAPI UCollationResult ucol_strcollinc(const UCollator *coll,
// as a tiebreaker if all else is equal
// NOTE: The java code compares result with 0, and
// puts the result of the string comparison directly into result
if (result == UCOL_EQUAL && cppColl->getStrength() == UCOL_IDENTICAL)
if (result == UCOL_EQUAL && strength == UCOL_IDENTICAL)
{
UnicodeString sourceDecomp, targetDecomp;
@ -1148,13 +1149,14 @@ ucol_strcoll( const UCollator *coll,
return UCOL_EQUAL;
}
UColAttributeValue strength = ucol_getAttribute(coll, UCOL_STRENGTH, &status);
int32_t sOrder, tOrder;
uint32_t pSOrder, pTOrder;
UBool gets = TRUE, gett = TRUE;
UBool initialCheckSecTer = cppColl->getStrength() >= UCOL_SECONDARY;
UBool initialCheckSecTer = strength >= UCOL_SECONDARY;
UBool checkSecTer = initialCheckSecTer;
UBool checkTertiary = cppColl->getStrength() >= UCOL_TERTIARY;
UBool checkQuad = cppColl->getStrength() >= UCOL_QUATERNARY;
UBool checkTertiary = strength >= UCOL_TERTIARY;
UBool checkQuad = strength >= UCOL_QUATERNARY;
UBool isFrenchSec = (cppColl->getAttribute(UCOL_FRENCH_COLLATION, status) == UCOL_ON) && checkSecTer;
if(!isFrenchSec) {
@ -1555,7 +1557,7 @@ ucol_strcoll( const UCollator *coll,
// as a tiebreaker if all else is equal
// NOTE: The java code compares result with 0, and
// puts the result of the string comparison directly into result
if (result == UCOL_EQUAL && cppColl->getStrength() == UCOL_IDENTICAL)
if (result == UCOL_EQUAL && strength == UCOL_IDENTICAL)
{
UnicodeString sourceDecomp, targetDecomp;