ICU-1760 add ubrk_isBoundary(), which was some how missing.

X-SVN-Rev: 7919
This commit is contained in:
Andy Heninger 2002-03-08 18:58:46 +00:00
parent fdc75f3083
commit 9981b416f2
3 changed files with 33 additions and 1 deletions

View File

@ -201,3 +201,10 @@ ubrk_countAvailable()
return uloc_countAvailable();
}
U_CAPI UBool U_EXPORT2
ubrk_isBoundary(UBreakIterator *bi, int32_t offset)
{
return ((BreakIterator *)bi)->isBoundary(offset);
};

View File

@ -387,4 +387,16 @@ ubrk_getAvailable(int32_t index);
U_CAPI int32_t U_EXPORT2
ubrk_countAvailable(void);
/**
* Returns true if the specfied position is a boundary position. As a side
* effect, leaves the iterator pointing to the first boundary position at
* or after "offset".
* @param bi The break iterator to use.
* @param offset the offset to check.
* @return True if "offset" is a boundary position.
*/
U_CAPI UBool U_EXPORT2
ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
#endif

View File

@ -49,6 +49,10 @@ static void TestBreakIteratorCAPI()
uint8_t buffer [CLONETEST_ITERATOR_COUNT] [U_BRK_SAFECLONE_BUFFERSIZE];
int32_t bufferSize = U_BRK_SAFECLONE_BUFFERSIZE;
/* Note: the adjacent "" are concatenating strings, not adding a \" to the
string, which is probably what whoever wrote this intended. Don't fix,
because it would throw off the hard coded break positions in the following
tests. */
u_uastrcpy(text, "He's from Africa. ""Mr. Livingston, I presume?"" Yeah");
@ -146,7 +150,16 @@ static void TestBreakIteratorCAPI()
pos=ubrk_previous(word);
log_verbose("%d \n", pos);
if (ubrk_isBoundary(word, 2) != FALSE) {
log_err("error ubrk_isBoundary(word, 2) did not return FALSE\n");
}
pos=ubrk_current(word);
if (pos != 4) {
log_err("error ubrk_current() != 4 after ubrk_isBoundary(word, 2)\n");
}
if (ubrk_isBoundary(word, 4) != TRUE) {
log_err("error ubrk_isBoundary(word, 4) did not return TRUE\n");
}