OLD | NEW |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
3 /** | 3 /** |
4 *******************************************************************************
***** | 4 *******************************************************************************
***** |
5 * Copyright (C) 2006-2012, International Business Machines Corporation and othe
rs. * | 5 * Copyright (C) 2006-2012, International Business Machines Corporation and othe
rs. * |
6 * All Rights Reserved.
* | 6 * All Rights Reserved.
* |
7 *******************************************************************************
***** | 7 *******************************************************************************
***** |
8 */ | 8 */ |
9 | 9 |
10 #ifndef BRKENG_H | 10 #ifndef BRKENG_H |
11 #define BRKENG_H | 11 #define BRKENG_H |
12 | 12 |
13 #include "unicode/utypes.h" | 13 #include "unicode/utypes.h" |
14 #include "unicode/uobject.h" | 14 #include "unicode/uobject.h" |
15 #include "unicode/utext.h" | 15 #include "unicode/utext.h" |
16 #include "unicode/uscript.h" | 16 #include "unicode/uscript.h" |
17 | 17 |
18 U_NAMESPACE_BEGIN | 18 U_NAMESPACE_BEGIN |
19 | 19 |
20 class UnicodeSet; | 20 class UnicodeSet; |
21 class UStack; | 21 class UStack; |
| 22 class UVector32; |
22 class DictionaryMatcher; | 23 class DictionaryMatcher; |
23 | 24 |
24 /******************************************************************* | 25 /******************************************************************* |
25 * LanguageBreakEngine | 26 * LanguageBreakEngine |
26 */ | 27 */ |
27 | 28 |
28 /** | 29 /** |
29 * <p>LanguageBreakEngines implement language-specific knowledge for | 30 * <p>LanguageBreakEngines implement language-specific knowledge for |
30 * finding text boundaries within a run of characters belonging to a | 31 * finding text boundaries within a run of characters belonging to a |
31 * specific set. The boundaries will be of a specific kind, e.g. word, | 32 * specific set. The boundaries will be of a specific kind, e.g. word, |
(...skipping 28 matching lines...) Expand all Loading... |
60 virtual UBool handles(UChar32 c, int32_t breakType) const = 0; | 61 virtual UBool handles(UChar32 c, int32_t breakType) const = 0; |
61 | 62 |
62 /** | 63 /** |
63 * <p>Find any breaks within a run in the supplied text.</p> | 64 * <p>Find any breaks within a run in the supplied text.</p> |
64 * | 65 * |
65 * @param text A UText representing the text. The | 66 * @param text A UText representing the text. The |
66 * iterator is left at the end of the run of characters which the engine | 67 * iterator is left at the end of the run of characters which the engine |
67 * is capable of handling. | 68 * is capable of handling. |
68 * @param startPos The start of the run within the supplied text. | 69 * @param startPos The start of the run within the supplied text. |
69 * @param endPos The end of the run within the supplied text. | 70 * @param endPos The end of the run within the supplied text. |
70 * @param reverse Whether the caller is looking for breaks in a reverse | |
71 * direction. | |
72 * @param breakType The type of break desired, or -1. | 71 * @param breakType The type of break desired, or -1. |
73 * @param foundBreaks An allocated C array of the breaks found, if any | 72 * @param foundBreaks A Vector of int32_t to receive the breaks. |
74 * @return The number of breaks found. | 73 * @return The number of breaks found. |
75 */ | 74 */ |
76 virtual int32_t findBreaks( UText *text, | 75 virtual int32_t findBreaks( UText *text, |
77 int32_t startPos, | 76 int32_t startPos, |
78 int32_t endPos, | 77 int32_t endPos, |
79 UBool reverse, | |
80 int32_t breakType, | 78 int32_t breakType, |
81 UStack &foundBreaks ) const = 0; | 79 UVector32 &foundBreaks ) const = 0; |
82 | 80 |
83 }; | 81 }; |
84 | 82 |
85 /******************************************************************* | 83 /******************************************************************* |
86 * LanguageBreakFactory | 84 * LanguageBreakFactory |
87 */ | 85 */ |
88 | 86 |
89 /** | 87 /** |
90 * <p>LanguageBreakFactorys find and return a LanguageBreakEngine | 88 * <p>LanguageBreakFactorys find and return a LanguageBreakEngine |
91 * that can determine breaks for characters in a specific set, if | 89 * that can determine breaks for characters in a specific set, if |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 virtual UBool handles(UChar32 c, int32_t breakType) const; | 183 virtual UBool handles(UChar32 c, int32_t breakType) const; |
186 | 184 |
187 /** | 185 /** |
188 * <p>Find any breaks within a run in the supplied text.</p> | 186 * <p>Find any breaks within a run in the supplied text.</p> |
189 * | 187 * |
190 * @param text A UText representing the text (TODO: UText). The | 188 * @param text A UText representing the text (TODO: UText). The |
191 * iterator is left at the end of the run of characters which the engine | 189 * iterator is left at the end of the run of characters which the engine |
192 * is capable of handling. | 190 * is capable of handling. |
193 * @param startPos The start of the run within the supplied text. | 191 * @param startPos The start of the run within the supplied text. |
194 * @param endPos The end of the run within the supplied text. | 192 * @param endPos The end of the run within the supplied text. |
195 * @param reverse Whether the caller is looking for breaks in a reverse | |
196 * direction. | |
197 * @param breakType The type of break desired, or -1. | 193 * @param breakType The type of break desired, or -1. |
198 * @param foundBreaks An allocated C array of the breaks found, if any | 194 * @param foundBreaks An allocated C array of the breaks found, if any |
199 * @return The number of breaks found. | 195 * @return The number of breaks found. |
200 */ | 196 */ |
201 virtual int32_t findBreaks( UText *text, | 197 virtual int32_t findBreaks( UText *text, |
202 int32_t startPos, | 198 int32_t startPos, |
203 int32_t endPos, | 199 int32_t endPos, |
204 UBool reverse, | |
205 int32_t breakType, | 200 int32_t breakType, |
206 UStack &foundBreaks ) const; | 201 UVector32 &foundBreaks ) const; |
207 | 202 |
208 /** | 203 /** |
209 * <p>Tell the engine to handle a particular character and break type.</p> | 204 * <p>Tell the engine to handle a particular character and break type.</p> |
210 * | 205 * |
211 * @param c A character which the engine should handle | 206 * @param c A character which the engine should handle |
212 * @param breakType The type of text break for which the engine should handle c | 207 * @param breakType The type of text break for which the engine should handle c |
213 */ | 208 */ |
214 virtual void handleCharacter(UChar32 c, int32_t breakType); | 209 virtual void handleCharacter(UChar32 c, int32_t breakType); |
215 | 210 |
216 }; | 211 }; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 * sought. | 277 * sought. |
283 * @return A DictionaryMatcher with the desired characteristics, or NULL. | 278 * @return A DictionaryMatcher with the desired characteristics, or NULL. |
284 */ | 279 */ |
285 virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script, int32_
t breakType); | 280 virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script, int32_
t breakType); |
286 }; | 281 }; |
287 | 282 |
288 U_NAMESPACE_END | 283 U_NAMESPACE_END |
289 | 284 |
290 /* BRKENG_H */ | 285 /* BRKENG_H */ |
291 #endif | 286 #endif |
OLD | NEW |