ICU-4009 Port Any-BreakInternal transliterator from Java

X-SVN-Rev: 23901
This commit is contained in:
Andy Heninger 2008-05-15 04:53:21 +00:00
parent 8ad2ddd4ca
commit eecf0b1bae
3 changed files with 8 additions and 10 deletions

View file

@ -35,6 +35,7 @@
#include "tolowtrn.h"
#include "toupptrn.h"
#include "uni2name.h"
#include "brktrans.h"
#include "esctrn.h"
#include "unesctrn.h"
#include "tridpars.h"
@ -1578,9 +1579,12 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
TitlecaseTransliterator* tempTitlecaseTranslit = new TitlecaseTransliterator();
UnicodeNameTransliterator* tempUnicodeTranslit = new UnicodeNameTransliterator();
NameUnicodeTransliterator* tempNameUnicodeTranslit = new NameUnicodeTransliterator();
BreakTransliterator* tempBreakTranslit = new BreakTransliterator();
// Check for null pointers
if (tempNullTranslit == NULL || tempLowercaseTranslit == NULL || tempUppercaseTranslit == NULL ||
tempTitlecaseTranslit == NULL || tempUnicodeTranslit == NULL || tempNameUnicodeTranslit == NULL)
tempTitlecaseTranslit == NULL || tempUnicodeTranslit == NULL ||
tempNameUnicodeTranslit == NULL || tempBreakTranslit == NULL)
{
delete tempNullTranslit;
delete tempLowercaseTranslit;
@ -1588,6 +1592,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
delete tempTitlecaseTranslit;
delete tempUnicodeTranslit;
delete tempNameUnicodeTranslit;
delete tempBreakTranslit;
// Since there was an error, remove registry
delete registry;
@ -1603,6 +1608,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
registry->put(tempTitlecaseTranslit, TRUE, status);
registry->put(tempUnicodeTranslit, TRUE, status);
registry->put(tempNameUnicodeTranslit, TRUE, status);
registry->put(tempBreakTranslit, FALSE, status); // FALSE means invisible.
RemoveTransliterator::registerIDs(); // Must be within mutex
EscapeTransliterator::registerIDs();

View file

@ -59,7 +59,7 @@ class TransliteratorIDParser;
* <code>transliterate()</code>. (However, this does <em>not</em>
* mean that threads may share transliterators without synchronizing
* them. Transliterators are not immutable, so they must be
* synchronized when shared between threads.) This1 might seem to
* synchronized when shared between threads.) This might seem to
* limit the complexity of the transliteration operation. In
* practice, subclasses perform complex transliterations by delaying
* the replacement of text until it is known that no other

View file

@ -227,10 +227,6 @@ void TransliteratorTest::TestInstantiation() {
i + ") != getAvailableIDs().snext()");
continue;
}
if(id2.indexOf("Thai")>-1 && !isICUVersionAtLeast(ICU_39)){
/* The Thai-Latin transliterator doesn't exist in ICU4C yet */
continue;
}
UParseError parseError;
UErrorCode status = U_ZERO_ERROR;
Transliterator* t = Transliterator::createInstance(id,
@ -3554,10 +3550,6 @@ void TransliteratorTest::TestIncrementalProgress(void) {
Transliterator::getAvailableVariant(k, source, target, variant);
UnicodeString id = source + "-" + target + "/" + variant;
if(id.indexOf("Thai")>-1 && !isICUVersionAtLeast(ICU_39)){
/* The Thai-Latin transliterator doesn't exist in ICU4C yet */
continue;
}
Transliterator *t = Transliterator::createInstance(id, UTRANS_FORWARD, err, status);
if (U_FAILURE(status)) {
errln((UnicodeString)"FAIL: Could not create " + id);