diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/icu/unicode/ubrk.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/icu/unicode/ubrk.h')
-rw-r--r-- | Source/WebCore/icu/unicode/ubrk.h | 70 |
1 files changed, 55 insertions, 15 deletions
diff --git a/Source/WebCore/icu/unicode/ubrk.h b/Source/WebCore/icu/unicode/ubrk.h index f8304a662..e9c0ef627 100644 --- a/Source/WebCore/icu/unicode/ubrk.h +++ b/Source/WebCore/icu/unicode/ubrk.h @@ -1,6 +1,6 @@ /* ****************************************************************************** -* Copyright (C) 1996-2010, International Business Machines Corporation and others. +* Copyright (C) 1996-2013, International Business Machines Corporation and others. * All Rights Reserved. ****************************************************************************** */ @@ -243,10 +243,12 @@ ubrk_openRules(const UChar *rules, /** * Thread safe cloning operation * @param bi iterator to be cloned - * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. + * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br> + * user allocated space for the new clone. If NULL new memory will be allocated. * If buffer is not large enough, new memory will be allocated. - * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. - * @param pBufferSize pointer to size of allocated space. + * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. + * @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.</em><br> + * pointer to size of allocated space. * If *pBufferSize == 0, a sufficient size for use in cloning will * be returned ('pre-flighting') * If *pBufferSize is not enough for a stack-based safe clone, @@ -263,11 +265,15 @@ ubrk_safeClone( int32_t *pBufferSize, UErrorCode *status); +#ifndef U_HIDE_DEPRECATED_API + /** * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone(). - * @stable ICU 2.0 + * @deprecated ICU 52. Do not rely on ubrk_safeClone() cloning into any provided buffer. */ -#define U_BRK_SAFECLONE_BUFFERSIZE 512 +#define U_BRK_SAFECLONE_BUFFERSIZE 1 + +#endif /* U_HIDE_DEPRECATED_API */ /** * Close a UBreakIterator. @@ -313,7 +319,13 @@ ubrk_setText(UBreakIterator* bi, /** - * Sets an existing iterator to point to a new piece of text + * Sets an existing iterator to point to a new piece of text. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by \ref ubrk_next, \ref ubrk_previous, etc. + * will be UTF-8 string indices, not UTF-16 positions. + * * @param bi The iterator to use * @param text The text to be set. * This function makes a shallow clone of the supplied UText. This means @@ -342,7 +354,7 @@ U_STABLE int32_t U_EXPORT2 ubrk_current(const UBreakIterator *bi); /** - * Determine the text boundary following the current text boundary. + * Advance the iterator to the boundary following the current boundary. * * @param bi The break iterator to use. * @return The character index of the next text boundary, or UBRK_DONE @@ -354,7 +366,7 @@ U_STABLE int32_t U_EXPORT2 ubrk_next(UBreakIterator *bi); /** - * Determine the text boundary preceding the current text boundary. + * Set the iterator position to the boundary preceding the current boundary. * * @param bi The break iterator to use. * @return The character index of the preceding text boundary, or UBRK_DONE @@ -366,7 +378,7 @@ U_STABLE int32_t U_EXPORT2 ubrk_previous(UBreakIterator *bi); /** - * Determine the index of the first character in the text being scanned. + * Set the iterator position to the index of the first character in the text being scanned. * This is not always the same as index 0 of the text. * @param bi The break iterator to use. * @return The character index of the first character in the text being scanned. @@ -377,8 +389,7 @@ U_STABLE int32_t U_EXPORT2 ubrk_first(UBreakIterator *bi); /** - * Determine the index immediately <EM>beyond</EM> the last character in the text being - * scanned. + * Set the iterator position to the index immediately <EM>beyond</EM> the last character in the text being scanned. * This is not the same as the last character. * @param bi The break iterator to use. * @return The character offset immediately <EM>beyond</EM> the last character in the @@ -390,8 +401,8 @@ U_STABLE int32_t U_EXPORT2 ubrk_last(UBreakIterator *bi); /** - * Determine the text boundary preceding the specified offset. - * The value returned is always smaller than offset, or UBRK_DONE. + * Set the iterator position to the first boundary preceding the specified offset. + * The new position is always smaller than offset, or UBRK_DONE. * @param bi The break iterator to use. * @param offset The offset to begin scanning. * @return The text boundary preceding offset, or UBRK_DONE. @@ -403,7 +414,7 @@ ubrk_preceding(UBreakIterator *bi, int32_t offset); /** - * Determine the text boundary following the specified offset. + * Advance the iterator to the first boundary following the specified offset. * The value returned is always greater than offset, or UBRK_DONE. * @param bi The break iterator to use. * @param offset The offset to begin scanning. @@ -495,6 +506,35 @@ ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, U_STABLE const char* U_EXPORT2 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); +/** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized + * system-level code. One example use case is with garbage collection + * that moves the text in memory. + * + * @param bi The break iterator. + * @param text The new (moved) text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 49 + */ +U_STABLE void U_EXPORT2 +ubrk_refreshUText(UBreakIterator *bi, + UText *text, + UErrorCode *status); #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ |