ICU-833
Because of the new Normalization enum conversion methods, changes have to be done in tbcoll. X-SVN-Rev: 3553
This commit is contained in:
parent
b41c0e7e55
commit
22052f8daa
@ -203,7 +203,8 @@ RuleBasedCollator::RuleBasedCollator(const UnicodeString& rules,
|
||||
rules.extract(0, length, pucharrules);
|
||||
pucharrules[length] = 0;
|
||||
|
||||
UNormalizationMode mode = getUNormalizationMode(decompositionMode);
|
||||
UNormalizationMode mode = Normalizer::getUNormalizationMode(
|
||||
decompositionMode, status);
|
||||
ucollator = ucol_openRules(pucharrules, length, mode,
|
||||
UCOL_DEFAULT_STRENGTH, &status);
|
||||
|
||||
@ -238,7 +239,8 @@ RuleBasedCollator::RuleBasedCollator(const UnicodeString& rules,
|
||||
pucharrules[length] = 0;
|
||||
|
||||
UCollationStrength strength = getUCollationStrength(collationStrength);
|
||||
UNormalizationMode mode = getUNormalizationMode(decompositionMode);
|
||||
UNormalizationMode mode = Normalizer::getUNormalizationMode(
|
||||
decompositionMode, status);
|
||||
ucollator = ucol_openRules(pucharrules, length, mode, strength, &status);
|
||||
if (U_SUCCESS(status))
|
||||
{
|
||||
@ -617,7 +619,9 @@ int32_t RuleBasedCollator::hashCode() const
|
||||
*/
|
||||
void RuleBasedCollator::setDecomposition(Normalizer::EMode mode)
|
||||
{
|
||||
ucol_setNormalization(ucollator, getUNormalizationMode(mode));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
ucol_setNormalization(ucollator, Normalizer::getUNormalizationMode(mode,
|
||||
status));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -627,7 +631,9 @@ void RuleBasedCollator::setDecomposition(Normalizer::EMode mode)
|
||||
*/
|
||||
Normalizer::EMode RuleBasedCollator::getDecomposition(void) const
|
||||
{
|
||||
return getNormalizerEMode(ucol_getNormalization(ucollator));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
return Normalizer::getNormalizerEMode(ucol_getNormalization(ucollator),
|
||||
status);
|
||||
}
|
||||
|
||||
// RuleBaseCollatorNew private constructor ----------------------------------
|
||||
|
@ -893,21 +893,6 @@ private:
|
||||
*/
|
||||
UCollationStrength getUCollationStrength(
|
||||
const Collator::ECollationStrength &strength) const;
|
||||
|
||||
/**
|
||||
* Converts C's Normalizer::EMode to UNormalizationMode
|
||||
* @param mode member of the enum Normalizer::EMode
|
||||
* @return UNormalizationMode equivalent of Normalizer::EMode
|
||||
*/
|
||||
UNormalizationMode getUNormalizationMode(const Normalizer::EMode &mode) const;
|
||||
|
||||
/**
|
||||
* Converts C++'s UNormalizationMode to Normalizer::EMode
|
||||
* @param mode member of the enum UNormalizationMode
|
||||
* @return Normalizer::EMode equivalent of UNormalizationMode
|
||||
*/
|
||||
Normalizer::EMode getNormalizerEMode(const UNormalizationMode &mode) const;
|
||||
|
||||
};
|
||||
|
||||
// inline method implementation ---------------------------------------------
|
||||
@ -983,42 +968,4 @@ inline UCollationStrength RuleBasedCollator::getUCollationStrength(
|
||||
return UCOL_IDENTICAL;
|
||||
}
|
||||
|
||||
inline UNormalizationMode RuleBasedCollator::getUNormalizationMode(
|
||||
const Normalizer::EMode &mode) const
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case Normalizer::NO_OP :
|
||||
return UCOL_NO_NORMALIZATION;
|
||||
case Normalizer::COMPOSE :
|
||||
return UCOL_DECOMP_CAN_COMP_COMPAT;
|
||||
case Normalizer::COMPOSE_COMPAT :
|
||||
return UCOL_DECOMP_COMPAT_COMP_CAN;
|
||||
case Normalizer::DECOMP :
|
||||
return UCOL_DECOMP_CAN;
|
||||
case Normalizer::DECOMP_COMPAT :
|
||||
return UCOL_DECOMP_COMPAT;
|
||||
}
|
||||
return UCOL_DEFAULT_NORMALIZATION;
|
||||
}
|
||||
|
||||
inline Normalizer::EMode RuleBasedCollator::getNormalizerEMode(
|
||||
const UNormalizationMode &mode) const
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case UCOL_NO_NORMALIZATION :
|
||||
return Normalizer::NO_OP;
|
||||
case UCOL_DECOMP_CAN :
|
||||
return Normalizer::DECOMP;
|
||||
case UCOL_DECOMP_COMPAT :
|
||||
return Normalizer::DECOMP_COMPAT;
|
||||
case UCOL_DECOMP_CAN_COMP_COMPAT :
|
||||
return Normalizer::COMPOSE;
|
||||
case UCOL_DECOMP_COMPAT_COMP_CAN :
|
||||
return Normalizer::COMPOSE_COMPAT;
|
||||
}
|
||||
return Normalizer::DECOMP_COMPAT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user