OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************** | 2 ******************************************************************************** |
3 * Copyright (C) 1997-2013, International Business Machines | 3 * Copyright (C) 1997-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************** | 5 ******************************************************************************** |
6 * | 6 * |
7 * File brkiter.h | 7 * File brkiter.h |
8 * | 8 * |
9 * Modification History: | 9 * Modification History: |
10 * | 10 * |
11 * Date Name Description | 11 * Date Name Description |
12 * 02/18/97 aliu Added typedef for TextCount. Made DONE const. | 12 * 02/18/97 aliu Added typedef for TextCount. Made DONE const. |
13 * 05/07/97 aliu Fixed DLL declaration. | 13 * 05/07/97 aliu Fixed DLL declaration. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 enum { | 206 enum { |
207 /** | 207 /** |
208 * DONE is returned by previous() and next() after all valid | 208 * DONE is returned by previous() and next() after all valid |
209 * boundaries have been returned. | 209 * boundaries have been returned. |
210 * @stable ICU 2.0 | 210 * @stable ICU 2.0 |
211 */ | 211 */ |
212 DONE = (int32_t)-1 | 212 DONE = (int32_t)-1 |
213 }; | 213 }; |
214 | 214 |
215 /** | 215 /** |
216 * Set the iterator position to the index of the first character in the text
being scanned. | 216 * Sets the current iteration position to the beginning of the text, positio
n zero. |
217 * @return The index of the first character in the text being scanned. | 217 * @return The offset of the beginning of the text, zero. |
218 * @stable ICU 2.0 | 218 * @stable ICU 2.0 |
219 */ | 219 */ |
220 virtual int32_t first(void) = 0; | 220 virtual int32_t first(void) = 0; |
221 | 221 |
222 /** | 222 /** |
223 * Set the iterator position to the index immediately BEYOND the last charac
ter in the text being scanned. | 223 * Set the iterator position to the index immediately BEYOND the last charac
ter in the text being scanned. |
224 * @return The index immediately BEYOND the last character in the text being
scanned. | 224 * @return The index immediately BEYOND the last character in the text being
scanned. |
225 * @stable ICU 2.0 | 225 * @stable ICU 2.0 |
226 */ | 226 */ |
227 virtual int32_t last(void) = 0; | 227 virtual int32_t last(void) = 0; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 * break rule that determined the most recently | 295 * break rule that determined the most recently |
296 * returned break position. | 296 * returned break position. |
297 * <p> | 297 * <p> |
298 * For break iterator types that do not support a rule status, | 298 * For break iterator types that do not support a rule status, |
299 * a default value of 0 is returned. | 299 * a default value of 0 is returned. |
300 * <p> | 300 * <p> |
301 * @return the status from the break rule that determined the most recently | 301 * @return the status from the break rule that determined the most recently |
302 * returned break position. | 302 * returned break position. |
303 * @see RuleBaseBreakIterator::getRuleStatus() | 303 * @see RuleBaseBreakIterator::getRuleStatus() |
304 * @see UWordBreak | 304 * @see UWordBreak |
305 * @draft ICU 52 | 305 * @stable ICU 52 |
306 */ | 306 */ |
307 virtual int32_t getRuleStatus() const; | 307 virtual int32_t getRuleStatus() const; |
308 | 308 |
309 /** | 309 /** |
310 * For RuleBasedBreakIterators, get the status (tag) values from the break ru
le(s) | 310 * For RuleBasedBreakIterators, get the status (tag) values from the break ru
le(s) |
311 * that determined the most recently returned break position. | 311 * that determined the most recently returned break position. |
312 * <p> | 312 * <p> |
313 * For break iterator types that do not support rule status, | 313 * For break iterator types that do not support rule status, |
314 * no values are returned. | 314 * no values are returned. |
315 * <p> | 315 * <p> |
316 * The returned status value(s) are stored into an array provided by the call
er. | 316 * The returned status value(s) are stored into an array provided by the call
er. |
317 * The values are stored in sorted (ascending) order. | 317 * The values are stored in sorted (ascending) order. |
318 * If the capacity of the output array is insufficient to hold the data, | 318 * If the capacity of the output array is insufficient to hold the data, |
319 * the output will be truncated to the available length, and a | 319 * the output will be truncated to the available length, and a |
320 * U_BUFFER_OVERFLOW_ERROR will be signaled. | 320 * U_BUFFER_OVERFLOW_ERROR will be signaled. |
321 * <p> | 321 * <p> |
322 * @see RuleBaseBreakIterator::getRuleStatusVec | 322 * @see RuleBaseBreakIterator::getRuleStatusVec |
323 * | 323 * |
324 * @param fillInVec an array to be filled in with the status values. | 324 * @param fillInVec an array to be filled in with the status values. |
325 * @param capacity the length of the supplied vector. A length of zero caus
es | 325 * @param capacity the length of the supplied vector. A length of zero caus
es |
326 * the function to return the number of status values, in th
e | 326 * the function to return the number of status values, in th
e |
327 * normal way, without attemtping to store any values. | 327 * normal way, without attemtping to store any values. |
328 * @param status receives error codes. | 328 * @param status receives error codes. |
329 * @return The number of rule status values from rules that determin
ed | 329 * @return The number of rule status values from rules that determin
ed |
330 * the most recent boundary returned by the break iterator. | 330 * the most recent boundary returned by the break iterator. |
331 * In the event of a U_BUFFER_OVERFLOW_ERROR, the return val
ue | 331 * In the event of a U_BUFFER_OVERFLOW_ERROR, the return val
ue |
332 * is the total number of status values that were available, | 332 * is the total number of status values that were available, |
333 * not the reduced number that were actually returned. | 333 * not the reduced number that were actually returned. |
334 * @see getRuleStatus | 334 * @see getRuleStatus |
335 * @draft ICU 52 | 335 * @stable ICU 52 |
336 */ | 336 */ |
337 virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErro
rCode &status); | 337 virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErro
rCode &status); |
338 | 338 |
339 /** | 339 /** |
340 * Create BreakIterator for word-breaks using the given locale. | 340 * Create BreakIterator for word-breaks using the given locale. |
341 * Returns an instance of a BreakIterator implementing word breaks. | 341 * Returns an instance of a BreakIterator implementing word breaks. |
342 * WordBreak is useful for word selection (ex. double click) | 342 * WordBreak is useful for word selection (ex. double click) |
343 * @param where the locale. | 343 * @param where the locale. |
344 * @param status the error code | 344 * @param status the error code |
345 * @return A BreakIterator for word-breaks. The UErrorCode& status | 345 * @return A BreakIterator for word-breaks. The UErrorCode& status |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 inline UBool isBufferClone(void); | 519 inline UBool isBufferClone(void); |
520 | 520 |
521 #endif /* U_HIDE_DEPRECATED_API */ | 521 #endif /* U_HIDE_DEPRECATED_API */ |
522 | 522 |
523 #if !UCONFIG_NO_SERVICE | 523 #if !UCONFIG_NO_SERVICE |
524 /** | 524 /** |
525 * Register a new break iterator of the indicated kind, to use in the given
locale. | 525 * Register a new break iterator of the indicated kind, to use in the given
locale. |
526 * The break iterator will be adopted. Clones of the iterator will be retur
ned | 526 * The break iterator will be adopted. Clones of the iterator will be retur
ned |
527 * if a request for a break iterator of the given kind matches or falls back
to | 527 * if a request for a break iterator of the given kind matches or falls back
to |
528 * this locale. | 528 * this locale. |
| 529 * Because ICU may choose to cache BreakIterators internally, this must |
| 530 * be called at application startup, prior to any calls to |
| 531 * BreakIterator::createXXXInstance to avoid undefined behavior. |
529 * @param toAdopt the BreakIterator instance to be adopted | 532 * @param toAdopt the BreakIterator instance to be adopted |
530 * @param locale the Locale for which this instance is to be registered | 533 * @param locale the Locale for which this instance is to be registered |
531 * @param kind the type of iterator for which this instance is to be registe
red | 534 * @param kind the type of iterator for which this instance is to be registe
red |
532 * @param status the in/out status code, no special meanings are assigned | 535 * @param status the in/out status code, no special meanings are assigned |
533 * @return a registry key that can be used to unregister this instance | 536 * @return a registry key that can be used to unregister this instance |
534 * @stable ICU 2.4 | 537 * @stable ICU 2.4 |
535 */ | 538 */ |
536 static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, | 539 static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, |
537 const Locale& locale, | 540 const Locale& locale, |
538 UBreakIteratorType kind, | 541 UBreakIteratorType kind, |
539 UErrorCode& status); | 542 UErrorCode& status); |
540 | 543 |
541 /** | 544 /** |
542 * Unregister a previously-registered BreakIterator using the key returned f
rom the | 545 * Unregister a previously-registered BreakIterator using the key returned f
rom the |
543 * register call. Key becomes invalid after a successful call and should no
t be used again. | 546 * register call. Key becomes invalid after a successful call and should no
t be used again. |
544 * The BreakIterator corresponding to the key will be deleted. | 547 * The BreakIterator corresponding to the key will be deleted. |
| 548 * Because ICU may choose to cache BreakIterators internally, this should |
| 549 * be called during application shutdown, after all calls to |
| 550 * BreakIterator::createXXXInstance to avoid undefined behavior. |
545 * @param key the registry key returned by a previous call to registerInstan
ce | 551 * @param key the registry key returned by a previous call to registerInstan
ce |
546 * @param status the in/out status code, no special meanings are assigned | 552 * @param status the in/out status code, no special meanings are assigned |
547 * @return TRUE if the iterator for the key was successfully unregistered | 553 * @return TRUE if the iterator for the key was successfully unregistered |
548 * @stable ICU 2.4 | 554 * @stable ICU 2.4 |
549 */ | 555 */ |
550 static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); | 556 static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); |
551 | 557 |
552 /** | 558 /** |
553 * Return a StringEnumeration over the locales available at the time of the
call, | 559 * Return a StringEnumeration over the locales available at the time of the
call, |
554 * including registered locales. | 560 * including registered locales. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 friend class ICUBreakIteratorFactory; | 616 friend class ICUBreakIteratorFactory; |
611 friend class ICUBreakIteratorService; | 617 friend class ICUBreakIteratorService; |
612 | 618 |
613 protected: | 619 protected: |
614 // Do not enclose protected default/copy constructors with #ifndef U_HIDE_IN
TERNAL_API | 620 // Do not enclose protected default/copy constructors with #ifndef U_HIDE_IN
TERNAL_API |
615 // or else the compiler will create a public ones. | 621 // or else the compiler will create a public ones. |
616 /** @internal */ | 622 /** @internal */ |
617 BreakIterator(); | 623 BreakIterator(); |
618 /** @internal */ | 624 /** @internal */ |
619 BreakIterator (const BreakIterator &other) : UObject(other) {} | 625 BreakIterator (const BreakIterator &other) : UObject(other) {} |
620 | 626 /** @internal */ |
| 627 BreakIterator (const Locale& valid, const Locale& actual); |
621 private: | 628 private: |
622 | 629 |
623 /** @internal */ | 630 /** @internal */ |
624 char actualLocale[ULOC_FULLNAME_CAPACITY]; | 631 char actualLocale[ULOC_FULLNAME_CAPACITY]; |
625 char validLocale[ULOC_FULLNAME_CAPACITY]; | 632 char validLocale[ULOC_FULLNAME_CAPACITY]; |
626 | 633 |
627 /** | 634 /** |
628 * The assignment operator has no real implementation. | 635 * The assignment operator has no real implementation. |
629 * It's provided to make the compiler happy. Do not call. | 636 * It's provided to make the compiler happy. Do not call. |
630 */ | 637 */ |
631 BreakIterator& operator=(const BreakIterator&); | 638 BreakIterator& operator=(const BreakIterator&); |
632 }; | 639 }; |
633 | 640 |
634 #ifndef U_HIDE_DEPRECATED_API | 641 #ifndef U_HIDE_DEPRECATED_API |
635 | 642 |
636 inline UBool BreakIterator::isBufferClone() | 643 inline UBool BreakIterator::isBufferClone() |
637 { | 644 { |
638 return FALSE; | 645 return FALSE; |
639 } | 646 } |
640 | 647 |
641 #endif /* U_HIDE_DEPRECATED_API */ | 648 #endif /* U_HIDE_DEPRECATED_API */ |
642 | 649 |
643 U_NAMESPACE_END | 650 U_NAMESPACE_END |
644 | 651 |
645 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ | 652 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ |
646 | 653 |
647 #endif // _BRKITER | 654 #endif // _BRKITER |
648 //eof | 655 //eof |
OLD | NEW |