00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1999-2003 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 00018 U_NAMESPACE_BEGIN 00019 00020 /* forward declaration */ 00021 class DictionaryBasedBreakIteratorTables; 00022 00062 class U_COMMON_API DictionaryBasedBreakIterator : public RuleBasedBreakIterator { 00063 00064 private: 00065 00072 int32_t* cachedBreakPositions; 00073 00077 int32_t numCachedBreakPositions; 00078 00083 int32_t positionInCache; 00084 00085 DictionaryBasedBreakIteratorTables *fTables; 00086 00090 static const char fgClassID; 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 virtual UClassID getDynamicClassID(void) const; 00190 00202 static inline UClassID getStaticClassID(void); 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 inline UClassID 00274 DictionaryBasedBreakIterator::getStaticClassID(void) 00275 { return (UClassID)(&fgClassID); } 00276 00277 inline UClassID 00278 DictionaryBasedBreakIterator::getDynamicClassID(void) const 00279 { return DictionaryBasedBreakIterator::getStaticClassID(); } 00280 00281 U_NAMESPACE_END 00282 00283 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ 00284 00285 #endif