00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1999-2005 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 #if !UCONFIG_NO_BREAK_ITERATION 00017 00023 U_NAMESPACE_BEGIN 00024 00025 /* forward declaration */ 00026 class DictionaryBasedBreakIteratorTables; 00027 00067 class U_COMMON_API DictionaryBasedBreakIterator : public RuleBasedBreakIterator { 00068 00069 private: 00070 00077 int32_t* cachedBreakPositions; 00078 00082 int32_t numCachedBreakPositions; 00083 00088 int32_t positionInCache; 00089 00090 DictionaryBasedBreakIteratorTables *fTables; 00091 00105 DictionaryBasedBreakIterator(UDataMemory* tablesImage, const char* dictionaryFilename, UErrorCode& status); 00106 00107 public: 00108 //======================================================================= 00109 // boilerplate 00110 //======================================================================= 00111 00116 virtual ~DictionaryBasedBreakIterator(); 00117 00124 DictionaryBasedBreakIterator(); 00125 00132 DictionaryBasedBreakIterator(const DictionaryBasedBreakIterator &other); 00133 00140 DictionaryBasedBreakIterator& operator=(const DictionaryBasedBreakIterator& that); 00141 00148 virtual BreakIterator* clone(void) const; 00149 00150 //======================================================================= 00151 // BreakIterator overrides 00152 //======================================================================= 00158 virtual int32_t previous(void); 00159 00167 virtual int32_t following(int32_t offset); 00168 00176 virtual int32_t preceding(int32_t offset); 00177 00189 static UClassID U_EXPORT2 getStaticClassID(void); 00190 00202 virtual UClassID getDynamicClassID(void) const; 00203 00204 protected: 00205 //======================================================================= 00206 // implementation 00207 //======================================================================= 00216 virtual int32_t handleNext(void); 00217 00223 virtual void reset(void); 00224 00229 void init(); 00230 00245 virtual BreakIterator * createBufferClone(void *stackBuffer, 00246 int32_t &BufferSize, 00247 UErrorCode &status); 00248 00249 00250 private: 00262 void divideUpDictionaryRange(int32_t startPos, int32_t endPos, UErrorCode &status); 00263 00264 00265 /* 00266 * HSYS : Please revisit with Rich, the ctors of the DBBI class is currently 00267 * marked as private. 00268 */ 00269 friend class DictionaryBasedBreakIteratorTables; 00270 friend class BreakIterator; 00271 }; 00272 00273 U_NAMESPACE_END 00274 00275 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ 00276 00277 #endif