00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1999-2000 IBM Corp. All rights reserved. 00004 ********************************************************************** 00005 * Date Name Description 00006 * 12/1/99 rgillam Complete port from Java. 00007 * 01/13/2000 helena Added UErrorCode to ctors. 00008 ********************************************************************** 00009 */ 00010 00011 #ifndef DBBI_H 00012 #define DBBI_H 00013 00014 #include "unicode/rbbi.h" 00015 00016 /* forward declaration */ 00017 class DictionaryBasedBreakIteratorTables; 00018 00047 class U_I18N_API DictionaryBasedBreakIterator : public RuleBasedBreakIterator { 00048 00049 private: 00054 int32_t dictionaryCharCount; 00055 00062 int32_t* cachedBreakPositions; 00063 00067 int32_t numCachedBreakPositions; 00068 00073 int32_t positionInCache; 00074 00078 static char fgClassID; 00079 00080 public: 00094 private: 00095 DictionaryBasedBreakIterator(const void* tablesImage, char* dictionaryFilename, UErrorCode& status); 00096 public: 00097 //======================================================================= 00098 // boilerplate 00099 //======================================================================= 00100 00104 virtual ~DictionaryBasedBreakIterator(); 00105 00110 DictionaryBasedBreakIterator& operator=(const DictionaryBasedBreakIterator& that); 00111 00116 virtual BreakIterator* clone(void) const; 00117 00118 //======================================================================= 00119 // BreakIterator overrides 00120 //======================================================================= 00125 virtual int32_t previous(void); 00126 00133 virtual int32_t following(int32_t offset); 00134 00141 virtual int32_t preceding(int32_t offset); 00142 00153 virtual UClassID getDynamicClassID(void) const; 00154 00165 static UClassID getStaticClassID(void); 00166 00167 protected: 00168 //======================================================================= 00169 // implementation 00170 //======================================================================= 00178 virtual int32_t handleNext(void); 00179 00184 virtual void reset(void); 00185 00186 private: 00195 void divideUpDictionaryRange(int32_t startPos, int32_t endPos); 00196 00201 void bumpDictionaryCharCount(void); 00202 00203 /* 00204 * HSYS : Please revisit with Rich, the ctors of the DBBI class is currently 00205 * marked as private. 00206 */ 00207 friend class DictionaryBasedBreakIteratorTables; 00208 friend class BreakIterator; 00209 }; 00210 00211 inline UClassID DictionaryBasedBreakIterator::getDynamicClassID(void) const { 00212 return RuleBasedBreakIterator::getStaticClassID(); 00213 } 00214 00215 inline UClassID DictionaryBasedBreakIterator::getStaticClassID(void) { 00216 return (UClassID)(&fgClassID); 00217 } 00218 00219 inline void DictionaryBasedBreakIterator::bumpDictionaryCharCount(void) { 00220 ++dictionaryCharCount; 00221 } 00222 00223 #endif