ICU-5279 Reduce internal API usage.
X-SVN-Rev: 21688
This commit is contained in:
parent
6cc5994f9f
commit
5d795c7f6c
@ -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;
|
||||
|
@ -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 <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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);
|
||||
|
@ -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<n; i++) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Transliterator *t = new RuleBasedTransliterator("<ID>",
|
||||
DATA[3*i], status);
|
||||
UParseError parseError;
|
||||
Transliterator *t = Transliterator::createFromRules("<ID>",
|
||||
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("<ID>", rule, UTRANS_FORWARD, 0, pe, ec);
|
||||
Transliterator *t = Transliterator::createFromRules("<ID>", rule, UTRANS_FORWARD, pe, ec);
|
||||
delete t;
|
||||
if (U_FAILURE(ec)) {
|
||||
logln((UnicodeString)"OK: Got exception for " + rule + ", as expected: " +
|
||||
|
@ -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 <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user