|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************** 00005 * Copyright (C) 1997-2016, International Business Machines 00006 * Corporation and others. All Rights Reserved. 00007 ******************************************************************************** 00008 * 00009 * File brkiter.h 00010 * 00011 * Modification History: 00012 * 00013 * Date Name Description 00014 * 02/18/97 aliu Added typedef for TextCount. Made DONE const. 00015 * 05/07/97 aliu Fixed DLL declaration. 00016 * 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK 00017 * 08/11/98 helena Sync-up JDK1.2. 00018 * 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. 00019 ******************************************************************************** 00020 */ 00021 00022 #ifndef BRKITER_H 00023 #define BRKITER_H 00024 00025 #include "unicode/utypes.h" 00026 00032 #include "unicode/utypes.h" 00033 00034 #if U_SHOW_CPLUSPLUS_API 00035 00036 #if UCONFIG_NO_BREAK_ITERATION 00037 00038 U_NAMESPACE_BEGIN 00039 00040 /* 00041 * Allow the declaration of APIs with pointers to BreakIterator 00042 * even when break iteration is removed from the build. 00043 */ 00044 class BreakIterator; 00045 00046 U_NAMESPACE_END 00047 00048 #else 00049 00050 #include "unicode/uobject.h" 00051 #include "unicode/unistr.h" 00052 #include "unicode/chariter.h" 00053 #include "unicode/locid.h" 00054 #include "unicode/ubrk.h" 00055 #include "unicode/strenum.h" 00056 #include "unicode/utext.h" 00057 #include "unicode/umisc.h" 00058 00059 U_NAMESPACE_BEGIN 00060 00106 class U_COMMON_API BreakIterator : public UObject { 00107 public: 00112 virtual ~BreakIterator(); 00113 00127 virtual bool operator==(const BreakIterator&) const = 0; 00128 00135 bool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); } 00136 00142 virtual BreakIterator* clone() const = 0; 00143 00149 virtual UClassID getDynamicClassID(void) const override = 0; 00150 00155 virtual CharacterIterator& getText(void) const = 0; 00156 00157 00172 virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0; 00173 00185 virtual void setText(const UnicodeString &text) = 0; 00186 00205 virtual void setText(UText *text, UErrorCode &status) = 0; 00206 00215 virtual void adoptText(CharacterIterator* it) = 0; 00216 00217 enum { 00223 DONE = (int32_t)-1 00224 }; 00225 00231 virtual int32_t first(void) = 0; 00232 00238 virtual int32_t last(void) = 0; 00239 00246 virtual int32_t previous(void) = 0; 00247 00254 virtual int32_t next(void) = 0; 00255 00261 virtual int32_t current(void) const = 0; 00262 00271 virtual int32_t following(int32_t offset) = 0; 00272 00281 virtual int32_t preceding(int32_t offset) = 0; 00282 00291 virtual UBool isBoundary(int32_t offset) = 0; 00292 00302 virtual int32_t next(int32_t n) = 0; 00303 00317 virtual int32_t getRuleStatus() const; 00318 00347 virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); 00348 00368 static BreakIterator* U_EXPORT2 00369 createWordInstance(const Locale& where, UErrorCode& status); 00370 00392 static BreakIterator* U_EXPORT2 00393 createLineInstance(const Locale& where, UErrorCode& status); 00394 00414 static BreakIterator* U_EXPORT2 00415 createCharacterInstance(const Locale& where, UErrorCode& status); 00416 00435 static BreakIterator* U_EXPORT2 00436 createSentenceInstance(const Locale& where, UErrorCode& status); 00437 00438 #ifndef U_HIDE_DEPRECATED_API 00439 00461 static BreakIterator* U_EXPORT2 00462 createTitleInstance(const Locale& where, UErrorCode& status); 00463 #endif /* U_HIDE_DEPRECATED_API */ 00464 00474 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); 00475 00485 static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, 00486 const Locale& displayLocale, 00487 UnicodeString& name); 00488 00497 static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, 00498 UnicodeString& name); 00499 00500 #ifndef U_FORCE_HIDE_DEPRECATED_API 00501 00520 virtual BreakIterator * createBufferClone(void *stackBuffer, 00521 int32_t &BufferSize, 00522 UErrorCode &status) = 0; 00523 #endif // U_FORCE_HIDE_DEPRECATED_API 00524 00525 #ifndef U_HIDE_DEPRECATED_API 00526 00533 inline UBool isBufferClone(void); 00534 00535 #endif /* U_HIDE_DEPRECATED_API */ 00536 00537 #if !UCONFIG_NO_SERVICE 00538 00553 static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, 00554 const Locale& locale, 00555 UBreakIteratorType kind, 00556 UErrorCode& status); 00557 00570 static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); 00571 00578 static StringEnumeration* U_EXPORT2 getAvailableLocales(void); 00579 #endif 00580 00586 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; 00587 00588 #ifndef U_HIDE_INTERNAL_API 00589 00595 const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; 00596 #endif /* U_HIDE_INTERNAL_API */ 00597 00623 virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0; 00624 00625 private: 00626 static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status); 00627 static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); 00628 static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); 00629 00630 friend class ICUBreakIteratorFactory; 00631 friend class ICUBreakIteratorService; 00632 00633 protected: 00634 // Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API 00635 // or else the compiler will create a public ones. 00637 BreakIterator(); 00639 BreakIterator (const BreakIterator &other); 00640 #ifndef U_HIDE_INTERNAL_API 00641 00642 BreakIterator (const Locale& valid, const Locale &actual); 00644 BreakIterator &operator = (const BreakIterator &other); 00645 #endif /* U_HIDE_INTERNAL_API */ 00646 00647 private: 00648 00650 char actualLocale[ULOC_FULLNAME_CAPACITY]; 00651 char validLocale[ULOC_FULLNAME_CAPACITY]; 00652 }; 00653 00654 #ifndef U_HIDE_DEPRECATED_API 00655 00656 inline UBool BreakIterator::isBufferClone() 00657 { 00658 return false; 00659 } 00660 00661 #endif /* U_HIDE_DEPRECATED_API */ 00662 00663 U_NAMESPACE_END 00664 00665 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ 00666 00667 #endif /* U_SHOW_CPLUSPLUS_API */ 00668 00669 #endif // BRKITER_H 00670 //eof
1.7.6.1