ICU-528 remove and stop using deprecated BreakIterator API

X-SVN-Rev: 3949
This commit is contained in:
Alan Liu 2001-03-07 22:42:46 +00:00
parent 640618cd8a
commit 4703c3cc0a
5 changed files with 46 additions and 41 deletions

View File

@ -165,22 +165,6 @@ RuleBasedBreakIterator::getText() const {
return *nonConstThis->text;
}
/**
* Returns a newly-created CharacterIterator that the caller is to take
* ownership of.
* THIS FUNCTION SHOULD NOT BE HERE. IT'S HERE BECAUSE BreakIterator DEFINES
* IT AS PURE VIRTUAL, FORCING RBBI TO IMPLEMENT IT. IT SHOULD BE REMOVED
* FROM *BOTH* CLASSES.
*/
CharacterIterator*
RuleBasedBreakIterator::createText() const {
if (text == NULL)
return new StringCharacterIterator("");
else
return text->clone();
}
/**
* Set the iterator to analyze a new piece of text. This function resets
* the current iteration position to the beginning of the text.
@ -213,6 +197,22 @@ RuleBasedBreakIterator::setText(const UnicodeString& newText) {
}
}
#ifdef ICU_ENABLE_DEPRECATED_BREAKITERATOR
/**
* Returns a newly-created CharacterIterator that the caller is to take
* ownership of.
* THIS FUNCTION SHOULD NOT BE HERE. IT'S HERE BECAUSE BreakIterator DEFINES
* IT AS PURE VIRTUAL, FORCING RBBI TO IMPLEMENT IT. IT SHOULD BE REMOVED
* FROM *BOTH* CLASSES.
*/
CharacterIterator*
RuleBasedBreakIterator::createText() const {
if (text == NULL)
return new StringCharacterIterator("");
else
return text->clone();
}
/**
* Set the iterator to analyze a new piece of text. This function resets
* the current iteration position to the beginning of the text.
@ -225,6 +225,7 @@ void
RuleBasedBreakIterator::setText(const UnicodeString* newText) {
setText(*newText);
}
#endif
/**
* Sets the current iteration position to the beginning of the text.

View File

@ -222,6 +222,7 @@ public:
*/
virtual const CharacterIterator& getText(void) const = 0;
#ifdef ICU_ENABLE_DEPRECATED_BREAKITERATOR
/**
* Get the text for which this object is finding the boundaries.
* @deprecated This will be removed after 2000-Dec-31. Use getText() instead.
@ -234,6 +235,7 @@ public:
* @deprecated Use setText(const UnicodeString&) instead.
*/
virtual void setText(const UnicodeString* it) = 0;
#endif
/**
* Change the text over which this operates. The text boundary is

View File

@ -293,6 +293,7 @@ RuleBasedBreakIterator(UDataMemory* image);
*/
virtual const CharacterIterator& getText(void) const;
#ifdef ICU_ENABLE_DEPRECATED_BREAKITERATOR
/**
* Returns a newly-created CharacterIterator that the caller is to take
* ownership of.
@ -303,6 +304,18 @@ RuleBasedBreakIterator(UDataMemory* image);
*/
virtual CharacterIterator* createText(void) const;
/**
* Set the iterator to analyze a new piece of text. This function resets
* the current iteration position to the beginning of the text.
* @param newText The text to analyze.
* @deprecated
* THIS FUNCTION SHOULD NOT BE HERE. IT'S HERE BECAUSE BreakIterator DEFINES
* IT AS PURE VIRTUAL, FORCING RBBI TO IMPLEMENT IT. IT SHOULD BE REMOVED
* FROM *BOTH* CLASSES. Use the other setText() instead.
*/
virtual void setText(const UnicodeString* newText);
#endif
/**
* Set the iterator to analyze a new piece of text. This function resets
* the current iteration position to the beginning of the text.
@ -318,17 +331,6 @@ RuleBasedBreakIterator(UDataMemory* image);
*/
virtual void setText(const UnicodeString& newText);
/**
* Set the iterator to analyze a new piece of text. This function resets
* the current iteration position to the beginning of the text.
* @param newText The text to analyze.
* @deprecated
* THIS FUNCTION SHOULD NOT BE HERE. IT'S HERE BECAUSE BreakIterator DEFINES
* IT AS PURE VIRTUAL, FORCING RBBI TO IMPLEMENT IT. IT SHOULD BE REMOVED
* FROM *BOTH* CLASSES. Use the other setText() instead.
*/
virtual void setText(const UnicodeString* newText);
/**
* Sets the current iteration position to the beginning of the text.
* (i.e., the CharacterIterator's starting offset).

View File

@ -678,7 +678,7 @@ void IntlTestTextBoundary::TestLineInvariants()
work[1] = noBreak[j];
for (k = 0; k < testChars.length(); k++) {
work[2] = testChars[k];
e->setText(&work);
e->setText(work);
for (int l = e->first(); l != BreakIterator::DONE; l = e->next())
if (l == 1 || l == 2) {
errln("Got break between U+" + UCharToUnicodeString(work[l - 1]) +
@ -714,7 +714,7 @@ void IntlTestTextBoundary::TestLineInvariants()
c == 0xfeff)
continue;
work[2] = c;
e->setText(&work);
e->setText(work);
UBool saw2 = FALSE;
for (int l = e->first(); l != BreakIterator::DONE; l = e->next())
if (l == 2)
@ -894,7 +894,7 @@ void IntlTestTextBoundary::TestJapaneseLineBreak()
for (i = 0; i < precedingChars.length(); i++) {
testString[1] = precedingChars[i];
iter->setText(&testString);
iter->setText(testString);
int32_t j = iter->first();
if (j != 0)
errln("ja line break failure: failed to start at 0");
@ -910,7 +910,7 @@ void IntlTestTextBoundary::TestJapaneseLineBreak()
for (i = 0; i < followingChars.length(); i++) {
testString[1] = followingChars[i];
iter->setText(&testString);
iter->setText(testString);
int j = iter->first();
if (j != 0)
errln("ja line break failure: failed to start at 0");
@ -986,7 +986,7 @@ void IntlTestTextBoundary::TestEndBehaviour()
errln("Failed to create the BreakIterator for default locale in TestEndBehaviour.\n");
return;
}
wb->setText(&testString);
wb->setText(testString);
if (wb->first() != 0)
errln("Didn't get break at beginning of string.");
@ -1038,7 +1038,7 @@ void IntlTestTextBoundary::TestPreceding()
return;
}
e->setText( &words3 );
e->setText( words3 );
e->first();
UTextOffset p1 = e->next();
UTextOffset p2 = e->next();
@ -1103,7 +1103,7 @@ void IntlTestTextBoundary::generalIteratorTest(BreakIterator& bi, Vector* expect
UnicodeString text = createTestData(elems);
delete elems;
bi.setText(&text);
bi.setText(text);
Vector *nextResults = testFirstAndNext(bi, text);
Vector *previousResults = testLastAndPrevious(bi, text);
@ -1310,7 +1310,7 @@ void IntlTestTextBoundary::testIsBoundary(BreakIterator& bi, UnicodeString& text
void IntlTestTextBoundary::doMultipleSelectionTest(BreakIterator& iterator,
UnicodeString& testText)
{
iterator.setText(&testText);
iterator.setText(testText);
BreakIterator* testIterator = iterator.clone();
int32_t offset = iterator.first();
@ -1378,7 +1378,7 @@ void IntlTestTextBoundary::doBreakInvariantTest(BreakIterator& tb, UnicodeString
continue;
work[2] = testChars[k];
tb.setText(&work);
tb.setText(work);
UBool seen2 = FALSE;
for (int l = tb.first(); l != BreakIterator::DONE; l = tb.next()) {
if (l == 2)
@ -1407,7 +1407,7 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
work[0] = testChars[i];
for (j = 0; j < testChars.length(); j++) {
work[3] = testChars[j];
tb.setText(&work);
tb.setText(work);
for (int32_t k = tb.first(); k != BreakIterator::DONE; k = tb.next())
if (k == 2) {
errln("Break between CR and LF in string U+" + UCharToUnicodeString(work[0]) +
@ -1434,7 +1434,7 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
(Unicode::getType(c) != Unicode::ENCLOSING_MARK))
continue;
work[2] = c;
tb.setText(&work);
tb.setText(work);
for (int k = tb.first(); k != BreakIterator::DONE; k = tb.next())
if (k == 2) {
errln("Break between U+" + UCharToUnicodeString(work[1])
@ -1455,7 +1455,7 @@ void IntlTestTextBoundary::sample(BreakIterator& tb,
UBool verboseWas = verbose;
verbose = TRUE;
logln("-------------------------"+title+" length = "+text.length());
tb.setText(&text);
tb.setText(text);
int32_t start = tb.first();
int32_t end;
for (end = tb.next(); end != BreakIterator::DONE; end = tb.next()) {

View File

@ -972,7 +972,7 @@ void RBBITest::generalIteratorTest(RuleBasedBreakIterator& bi, Vector* expectedR
UnicodeString text = createTestData(elems);
delete elems;
bi.setText(&text);
bi.setText(text);
Vector *nextResults = testFirstAndNext(bi, text);
Vector *previousResults = testLastAndPrevious(bi, text);
@ -1178,7 +1178,7 @@ void RBBITest::testIsBoundary(RuleBasedBreakIterator& bi, UnicodeString& text, i
void RBBITest::doMultipleSelectionTest(RuleBasedBreakIterator& iterator,
UnicodeString& testText)
{
iterator.setText(&testText);
iterator.setText(testText);
RuleBasedBreakIterator* testIterator =(RuleBasedBreakIterator*)iterator.clone();
int32_t offset = iterator.first();