From 5d795c7f6c8cc284a64d4de3bf5550cb056f5ecc Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Mon, 11 Jun 2007 06:05:41 +0000 Subject: [PATCH] ICU-5279 Reduce internal API usage. X-SVN-Rev: 21688 --- icu4c/source/test/intltest/jamotest.cpp | 12 ++++++------ icu4c/source/test/intltest/transapi.cpp | 6 +++--- icu4c/source/test/intltest/transtst.cpp | 7 ++++--- icu4c/source/test/intltest/trnserr.cpp | 14 ++++++-------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/icu4c/source/test/intltest/jamotest.cpp b/icu4c/source/test/intltest/jamotest.cpp index 01fc40988a..326c5c4105 100644 --- a/icu4c/source/test/intltest/jamotest.cpp +++ b/icu4c/source/test/intltest/jamotest.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2006, International Business Machines Corporation and + * Copyright (c) 1997-2007, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************** ************************************************************************ @@ -16,7 +16,6 @@ #include "jamotest.h" #include "unicode/utypes.h" #include "unicode/translit.h" -#include "rbt.h" #include "cpdtrans.h" // SEP is the disambiguation separator used by Latin-Jamo and Jamo-Latin @@ -24,19 +23,20 @@ JamoTest::JamoTest() { + UParseError parseError; UErrorCode status = U_ZERO_ERROR; - NAME_JAMO = new RuleBasedTransliterator("Name-Jamo", + NAME_JAMO = Transliterator::createFromRules("Name-Jamo", JAMO_NAMES_RULES, - UTRANS_FORWARD, status); + UTRANS_FORWARD, parseError, status); if (U_FAILURE(status)) { delete NAME_JAMO; NAME_JAMO = NULL; } status = U_ZERO_ERROR; - JAMO_NAME = new RuleBasedTransliterator("Jamo-Name", + JAMO_NAME = Transliterator::createFromRules("Jamo-Name", JAMO_NAMES_RULES, - UTRANS_REVERSE, status); + UTRANS_REVERSE, parseError, status); if (U_FAILURE(status)) { delete JAMO_NAME; JAMO_NAME = NULL; diff --git a/icu4c/source/test/intltest/transapi.cpp b/icu4c/source/test/intltest/transapi.cpp index 72e804e25e..9fbd71b5e6 100644 --- a/icu4c/source/test/intltest/transapi.cpp +++ b/icu4c/source/test/intltest/transapi.cpp @@ -16,10 +16,8 @@ #include "transapi.h" #include "unicode/utypes.h" #include "unicode/translit.h" -#include "rbt.h" #include "unicode/unifilt.h" #include "cpdtrans.h" -#include "nultrans.h" #include #include #include @@ -664,8 +662,10 @@ void TransliteratorAPITest::TestRegisterUnregister(){ status =U_ZERO_ERROR; /* Create it */ - Transliterator *t = new RuleBasedTransliterator("TestA-TestB", + UParseError parseError; + Transliterator *t = Transliterator::createFromRules("TestA-TestB", "a<>b", + UTRANS_FORWARD, parseError, status); /* Register it */ Transliterator::registerInstance(t); diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index efc30791c3..c5c860571c 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -1010,8 +1010,9 @@ void TransliteratorTest::TestPositionHandling(void) { int32_t n = (int32_t)(sizeof(DATA) / sizeof(DATA[0])) / 3; for (int32_t i=0; i", - DATA[3*i], status); + UParseError parseError; + Transliterator *t = Transliterator::createFromRules("", + DATA[3*i], UTRANS_FORWARD, parseError, status); if (U_FAILURE(status)) { delete t; errln("FAIL: RBT constructor"); @@ -2250,7 +2251,7 @@ void TransliteratorTest::TestUndefinedVariable() { UnicodeString rule = "$initial } a <> \\u1161;"; UParseError pe; UErrorCode ec = U_ZERO_ERROR; - Transliterator *t = new RuleBasedTransliterator("", rule, UTRANS_FORWARD, 0, pe, ec); + Transliterator *t = Transliterator::createFromRules("", rule, UTRANS_FORWARD, pe, ec); delete t; if (U_FAILURE(ec)) { logln((UnicodeString)"OK: Got exception for " + rule + ", as expected: " + diff --git a/icu4c/source/test/intltest/trnserr.cpp b/icu4c/source/test/intltest/trnserr.cpp index 0b76616672..b4897bd9df 100644 --- a/icu4c/source/test/intltest/trnserr.cpp +++ b/icu4c/source/test/intltest/trnserr.cpp @@ -22,10 +22,8 @@ #include "unicode/utypes.h" #include "unicode/translit.h" #include "unicode/uniset.h" -#include "rbt.h" #include "unicode/unifilt.h" #include "cpdtrans.h" -#include "nultrans.h" #include #include #include @@ -145,7 +143,7 @@ void TransliteratorErrorTest::TestTransliteratorErrors() { delete t1; } status = U_ZERO_ERROR; - Transliterator* t2 = new RuleBasedTransliterator(newID, newIDRules, UTRANS_FORWARD, status); + Transliterator* t2 = Transliterator::createFromRules(newID, newIDRules, UTRANS_FORWARD, parseError, status); if (U_SUCCESS(status)) { Transliterator* t3 = t2->createInverse(status); if (U_SUCCESS(status)) { @@ -219,18 +217,18 @@ void TransliteratorErrorTest::TestRBTErrors() { UnicodeString rules="ab>y"; UnicodeString id="MyRandom-YReverse"; - UnicodeString goodPattern="[[:L:]&[\\u0000-\\uFFFF]]"; /* all BMP letters */ + //UnicodeString goodPattern="[[:L:]&[\\u0000-\\uFFFF]]"; /* all BMP letters */ UErrorCode status = U_ZERO_ERROR; UParseError parseErr; - UnicodeSet *set = new UnicodeSet(goodPattern, status); + /*UnicodeSet *set = new UnicodeSet(goodPattern, status); if (U_FAILURE(status)) { errln("FAIL: Was not able to create a good UnicodeSet based on valid patterns."); return; - } - RuleBasedTransliterator *t = new RuleBasedTransliterator(id, rules, UTRANS_REVERSE, set, parseErr, status); + }*/ + Transliterator *t = Transliterator::createFromRules(id, rules, UTRANS_REVERSE, parseErr, status); if (U_FAILURE(status)) { errln("FAIL: Was not able to create a good RBT to test registration."); - delete set; + //delete set; return; } Transliterator::registerInstance(t);