diff options
Diffstat (limited to 'Build/source/libs/icu-xetex/common/unicode/ubrk.h')
-rw-r--r-- | Build/source/libs/icu-xetex/common/unicode/ubrk.h | 169 |
1 files changed, 34 insertions, 135 deletions
diff --git a/Build/source/libs/icu-xetex/common/unicode/ubrk.h b/Build/source/libs/icu-xetex/common/unicode/ubrk.h index f4e734aa5c4..39f25cf8833 100644 --- a/Build/source/libs/icu-xetex/common/unicode/ubrk.h +++ b/Build/source/libs/icu-xetex/common/unicode/ubrk.h @@ -1,6 +1,8 @@ /* -* Copyright (C) 1996-2005, International Business Machines Corporation and others. All Rights Reserved. -***************************************************************************************** +****************************************************************************** +* Copyright (C) 1996-2006, International Business Machines Corporation and others. +* All Rights Reserved. +****************************************************************************** */ #ifndef UBRK_H @@ -37,22 +39,22 @@ * of boundaries in text. Pointer to a UBreakIterator maintain a * current position and scan over text returning the index of characters * where boundaries occur. - * <P> + * <p> * Line boundary analysis determines where a text string can be broken * when line-wrapping. The mechanism correctly handles punctuation and * hyphenated words. - * <P> + * <p> * Sentence boundary analysis allows selection with correct * interpretation of periods within numbers and abbreviations, and * trailing punctuation marks such as quotation marks and parentheses. - * <P> + * <p> * Word boundary analysis is used by search and replace functions, as * well as within text editing applications that allow the user to * select words with a double click. Word selection provides correct * interpretation of punctuation marks within and following * words. Characters that are not part of a word, such as symbols or * punctuation marks, have word-breaks on both sides. - * <P> + * <p> * Character boundary analysis allows users to interact with * characters as they expect to, for example, when moving the cursor * through a text string. Character boundary analysis provides correct @@ -60,140 +62,37 @@ * character is stored. For example, an accented character might be * stored as a base character and a diacritical mark. What users * consider to be a character can differ between languages. - * <P> + * <p> * Title boundary analysis locates all positions, * typically starts of words, that should be set to Title Case * when title casing the text. - * <P> - * - * This is the interface for all text boundaries. - * <P> - * Examples: - * <P> - * Helper function to output text - * <pre> - * \code - * void printTextRange(UChar* str, int32_t start, int32_t end ) { - * UChar* result; - * UChar* temp; - * const char* res; - * temp=(UChar*)malloc(sizeof(UChar) * ((u_strlen(str)-start)+1)); - * result=(UChar*)malloc(sizeof(UChar) * ((end-start)+1)); - * u_strcpy(temp, &str[start]); - * u_strncpy(result, temp, end-start); - * res=(char*)malloc(sizeof(char) * (u_strlen(result)+1)); - * u_austrcpy(res, result); - * printf("%s\n", res); - * } - * \endcode - * </pre> - * Print each element in order: - * <pre> - * \code - * void printEachForward( UBreakIterator* boundary, UChar* str) { - * int32_t end; - * int32_t start = ubrk_first(boundary); - * for (end = ubrk_next(boundary)); end != UBRK_DONE; start = end, end = ubrk_next(boundary)) { - * printTextRange(str, start, end ); - * } - * } - * \endcode - * </pre> - * Print each element in reverse order: - * <pre> - * \code - * void printEachBackward( UBreakIterator* boundary, UChar* str) { - * int32_t start; - * int32_t end = ubrk_last(boundary); - * for (start = ubrk_previous(boundary); start != UBRK_DONE; end = start, start =ubrk_previous(boundary)) { - * printTextRange( str, start, end ); - * } - * } - * \endcode - * </pre> - * Print first element - * <pre> - * \code - * void printFirst(UBreakIterator* boundary, UChar* str) { - * int32_t end; - * int32_t start = ubrk_first(boundary); - * end = ubrk_next(boundary); - * printTextRange( str, start, end ); - * } - * \endcode - * </pre> - * Print last element - * <pre> - * \code - * void printLast(UBreakIterator* boundary, UChar* str) { - * int32_t start; - * int32_t end = ubrk_last(boundary); - * start = ubrk_previous(boundary); - * printTextRange(str, start, end ); - * } - * \endcode - * </pre> - * Print the element at a specified position - * <pre> - * \code - * void printAt(UBreakIterator* boundary, int32_t pos , UChar* str) { - * int32_t start; - * int32_t end = ubrk_following(boundary, pos); - * start = ubrk_previous(boundary); - * printTextRange(str, start, end ); - * } - * \endcode - * </pre> - * Creating and using text boundaries - * <pre> - * \code - * void BreakIterator_Example( void ) { - * UBreakIterator* boundary; - * UChar *stringToExamine; - * stringToExamine=(UChar*)malloc(sizeof(UChar) * (strlen("Aaa bbb ccc. Ddd eee fff.")+1) ); - * u_uastrcpy(stringToExamine, "Aaa bbb ccc. Ddd eee fff."); - * printf("Examining: "Aaa bbb ccc. Ddd eee fff."); - * - * //print each sentence in forward and reverse order - * boundary = ubrk_open(UBRK_SENTENCE, "en_us", stringToExamine, u_strlen(stringToExamine), &status); - * printf("----- forward: -----------\n"); - * printEachForward(boundary, stringToExamine); - * printf("----- backward: ----------\n"); - * printEachBackward(boundary, stringToExamine); - * ubrk_close(boundary); - * - * //print each word in order - * boundary = ubrk_open(UBRK_WORD, "en_us", stringToExamine, u_strlen(stringToExamine), &status); - * printf("----- forward: -----------\n"); - * printEachForward(boundary, stringToExamine); - * printf("----- backward: ----------\n"); - * printEachBackward(boundary, stringToExamine); - * //print first element - * printf("----- first: -------------\n"); - * printFirst(boundary, stringToExamine); - * //print last element - * printf("----- last: --------------\n"); - * printLast(boundary, stringToExamine); - * //print word at charpos 10 - * printf("----- at pos 10: ---------\n"); - * printAt(boundary, 10 , stringToExamine); - * - * ubrk_close(boundary); - * } - * \endcode - * </pre> + * <p> + * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + * <p> + * In addition to the plain C API defined in this header file, an + * object oriented C++ API with equivalent functionality is defined in the + * file brkiter.h. + * <p> + * Code snippits illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * http://icu.sourceforge.net/userguide/boundaryAnalysis.html + * and in the sample program icu/source/samples/break/break.cpp" */ /** The possible types of text boundaries. @stable ICU 2.0 */ typedef enum UBreakIteratorType { /** Character breaks @stable ICU 2.0 */ - UBRK_CHARACTER, + UBRK_CHARACTER = 0, /** Word breaks @stable ICU 2.0 */ - UBRK_WORD, + UBRK_WORD = 1, /** Line breaks @stable ICU 2.0 */ - UBRK_LINE, + UBRK_LINE = 2, /** Sentence breaks @stable ICU 2.0 */ - UBRK_SENTENCE, + UBRK_SENTENCE = 3, #ifndef U_HIDE_DEPRECATED_API /** @@ -204,9 +103,9 @@ typedef enum UBreakIteratorType { * * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. */ - UBRK_TITLE + UBRK_TITLE = 4, #endif /* U_HIDE_DEPRECATED_API */ - + UBRK_COUNT = 5 } UBreakIteratorType; /** Value indicating all text boundaries have been returned. @@ -556,9 +455,9 @@ ubrk_getRuleStatus(UBreakIterator *bi); * @param status receives error codes. * @return The number of rule status values from rules that determined * the most recent boundary returned by the break iterator. - * @draft ICU 3.0 + * @stable ICU 3.0 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); /** @@ -568,9 +467,9 @@ ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, * @param type locale type (valid or actual) * @param status error code * @return locale string - * @draft ICU 2.8 likely to change after ICU 3.0, based on feedback + * @stable ICU 2.8 */ -U_DRAFT const char* U_EXPORT2 +U_STABLE const char* U_EXPORT2 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); |