mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-3004 Transliterators can't do locale sensitive casing due to how the transliterator registry is used.
Remove any code that attempts to do locale sensitive casing. Bug #4324 has been filed to properly add this feature. X-SVN-Rev: 17024
This commit is contained in:
parent
9dcd00ba1e
commit
f6860c5a75
8 changed files with 15 additions and 26 deletions
|
@ -84,15 +84,13 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CaseMapTransliterator)
|
|||
/**
|
||||
* Constructs a transliterator.
|
||||
*/
|
||||
CaseMapTransliterator::CaseMapTransliterator(const Locale &loc, const UnicodeString &id, UCaseMapFull *map) :
|
||||
CaseMapTransliterator::CaseMapTransliterator(const UnicodeString &id, UCaseMapFull *map) :
|
||||
Transliterator(id, 0),
|
||||
fLoc(loc), fLocName(NULL),
|
||||
fCsp(NULL),
|
||||
fMap(map)
|
||||
{
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
fCsp = ucase_getSingleton(&errorCode); // expect to get NULL if failure
|
||||
fLocName=fLoc.getName();
|
||||
|
||||
// TODO test incremental mode with context-sensitive text (e.g. greek sigma)
|
||||
// TODO need to call setMaximumContextLength()?!
|
||||
|
@ -109,9 +107,8 @@ CaseMapTransliterator::~CaseMapTransliterator() {
|
|||
*/
|
||||
CaseMapTransliterator::CaseMapTransliterator(const CaseMapTransliterator& o) :
|
||||
Transliterator(o),
|
||||
fLoc(o.fLoc), fLocName(NULL), fCsp(o.fCsp), fMap(o.fMap)
|
||||
fCsp(o.fCsp), fMap(o.fMap)
|
||||
{
|
||||
fLocName=fLoc.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,8 +116,6 @@ CaseMapTransliterator::CaseMapTransliterator(const CaseMapTransliterator& o) :
|
|||
*/
|
||||
CaseMapTransliterator& CaseMapTransliterator::operator=(const CaseMapTransliterator& o) {
|
||||
Transliterator::operator=(o);
|
||||
fLoc = o.fLoc;
|
||||
fLocName = fLoc.getName();
|
||||
fCsp = o.fCsp;
|
||||
fMap = o.fMap;
|
||||
return *this;
|
||||
|
@ -160,7 +155,7 @@ void CaseMapTransliterator::handleTransliterate(Replaceable& text,
|
|||
c=text.char32At(textPos);
|
||||
csc.cpLimit=textPos+=U16_LENGTH(c);
|
||||
|
||||
result=fMap(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, fLocName, &locCache);
|
||||
result=fMap(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, "", &locCache);
|
||||
|
||||
if(csc.b1 && isIncremental) {
|
||||
// fMap() tried to look beyond the context limit
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#if !UCONFIG_NO_TRANSLITERATION
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/locid.h"
|
||||
#include "ucase.h"
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
@ -51,7 +50,7 @@ public:
|
|||
* @param id the transliterator ID.
|
||||
* @param map the full case mapping function (see ucase.h)
|
||||
*/
|
||||
CaseMapTransliterator(const Locale &loc, const UnicodeString &id, UCaseMapFull *map);
|
||||
CaseMapTransliterator(const UnicodeString &id, UCaseMapFull *map);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
@ -98,8 +97,6 @@ protected:
|
|||
UTransPosition& offsets,
|
||||
UBool isIncremental) const;
|
||||
|
||||
Locale fLoc;
|
||||
const char *fLocName;
|
||||
UCaseProps *fCsp;
|
||||
UCaseMapFull *fMap;
|
||||
};
|
||||
|
|
|
@ -24,8 +24,8 @@ U_NAMESPACE_BEGIN
|
|||
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TitlecaseTransliterator)
|
||||
|
||||
TitlecaseTransliterator::TitlecaseTransliterator(const Locale& theLoc) :
|
||||
CaseMapTransliterator(theLoc, UNICODE_STRING("Any-Title", 9), NULL)
|
||||
TitlecaseTransliterator::TitlecaseTransliterator() :
|
||||
CaseMapTransliterator(UNICODE_STRING("Any-Title", 9), NULL)
|
||||
{
|
||||
// Need to look back 2 characters in the case of "can't"
|
||||
setMaximumContextLength(2);
|
||||
|
@ -125,9 +125,9 @@ void TitlecaseTransliterator::handleTransliterate(
|
|||
type=ucase_getTypeOrIgnorable(fCsp, c);
|
||||
if(type>=0) { // not case-ignorable
|
||||
if(doTitle) {
|
||||
result=ucase_toFullTitle(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, fLocName, &locCache);
|
||||
result=ucase_toFullTitle(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, "", &locCache);
|
||||
} else {
|
||||
result=ucase_toFullLower(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, fLocName, &locCache);
|
||||
result=ucase_toFullLower(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, "", &locCache);
|
||||
}
|
||||
doTitle = (UBool)(type==0); // doTitle=isUncased
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#if !UCONFIG_NO_TRANSLITERATION
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/locid.h"
|
||||
#include "ucase.h"
|
||||
#include "casetrn.h"
|
||||
|
||||
|
@ -35,7 +34,7 @@ class U_I18N_API TitlecaseTransliterator : public CaseMapTransliterator {
|
|||
* Constructs a transliterator.
|
||||
* @param loc the given locale.
|
||||
*/
|
||||
TitlecaseTransliterator(const Locale& loc = Locale::getDefault());
|
||||
TitlecaseTransliterator();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
|
|
@ -25,8 +25,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LowercaseTransliterator)
|
|||
/**
|
||||
* Constructs a transliterator.
|
||||
*/
|
||||
LowercaseTransliterator::LowercaseTransliterator(const Locale& theLoc) :
|
||||
CaseMapTransliterator(theLoc, UNICODE_STRING("Any-Lower", 9), ucase_toFullLower)
|
||||
LowercaseTransliterator::LowercaseTransliterator() :
|
||||
CaseMapTransliterator(UNICODE_STRING("Any-Lower", 9), ucase_toFullLower)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#if !UCONFIG_NO_TRANSLITERATION
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/locid.h"
|
||||
#include "casetrn.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
@ -33,7 +32,7 @@ class U_I18N_API LowercaseTransliterator : public CaseMapTransliterator {
|
|||
* Constructs a transliterator.
|
||||
* @param loc the given locale.
|
||||
*/
|
||||
LowercaseTransliterator(const Locale& loc = Locale::getDefault());
|
||||
LowercaseTransliterator();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
|
|
@ -25,8 +25,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UppercaseTransliterator)
|
|||
/**
|
||||
* Constructs a transliterator.
|
||||
*/
|
||||
UppercaseTransliterator::UppercaseTransliterator(const Locale& theLoc) :
|
||||
CaseMapTransliterator(theLoc, UNICODE_STRING("Any-Upper", 9), ucase_toFullUpper)
|
||||
UppercaseTransliterator::UppercaseTransliterator() :
|
||||
CaseMapTransliterator(UNICODE_STRING("Any-Upper", 9), ucase_toFullUpper)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#if !UCONFIG_NO_TRANSLITERATION
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/locid.h"
|
||||
#include "casetrn.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
@ -33,7 +32,7 @@ class U_I18N_API UppercaseTransliterator : public CaseMapTransliterator {
|
|||
* Constructs a transliterator.
|
||||
* @param loc the given locale.
|
||||
*/
|
||||
UppercaseTransliterator(const Locale& loc = Locale::getDefault());
|
||||
UppercaseTransliterator();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
|
Loading…
Add table
Reference in a new issue