Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

dbbi.h

00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1999-2001 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 U_NAMESPACE_BEGIN
00017 
00018 /* forward declaration */
00019 class DictionaryBasedBreakIteratorTables;
00020 
00049 class U_COMMON_API DictionaryBasedBreakIterator : public RuleBasedBreakIterator {
00050 
00051 private:
00056     int32_t dictionaryCharCount;
00057 
00064     int32_t* cachedBreakPositions;
00065 
00069     int32_t numCachedBreakPositions;
00070 
00075     int32_t positionInCache;
00076 
00080     static const char fgClassID;
00081 
00095     DictionaryBasedBreakIterator(UDataMemory* tablesImage, const char* dictionaryFilename, UErrorCode& status);
00096 
00097 public:
00098     //=======================================================================
00099     // boilerplate
00100     //=======================================================================
00101 
00105     virtual ~DictionaryBasedBreakIterator();
00106 
00111     DictionaryBasedBreakIterator& operator=(const DictionaryBasedBreakIterator& that);
00112 
00117     virtual BreakIterator* clone(void) const;
00118 
00119     //=======================================================================
00120     // BreakIterator overrides
00121     //=======================================================================
00126     virtual int32_t previous(void);
00127 
00134     virtual int32_t following(int32_t offset);
00135 
00142     virtual int32_t preceding(int32_t offset);
00143 
00154     virtual UClassID getDynamicClassID(void) const;
00155 
00166     static UClassID getStaticClassID(void);
00167 
00168 protected:
00169     //=======================================================================
00170     // implementation
00171     //=======================================================================
00179     virtual int32_t handleNext(void);
00180 
00185     virtual void reset(void);
00186 
00187     virtual BreakIterator *  createBufferClone(void *stackBuffer,
00188                                                int32_t &BufferSize,
00189                                                UErrorCode &status);
00190 
00191 
00192 private:
00201     void divideUpDictionaryRange(int32_t startPos, int32_t endPos, UErrorCode &status);
00202 
00207     void bumpDictionaryCharCount(void);
00208 
00209     /*
00210      * HSYS : Please revisit with Rich, the ctors of the DBBI class is currently
00211      * marked as private.
00212      */
00213     friend class DictionaryBasedBreakIteratorTables;
00214     friend class BreakIterator;
00215 };
00216 
00217 inline UClassID DictionaryBasedBreakIterator::getDynamicClassID(void) const {
00218     return RuleBasedBreakIterator::getStaticClassID();
00219 }
00220 
00221 inline UClassID DictionaryBasedBreakIterator::getStaticClassID(void) {
00222     return (UClassID)(&fgClassID);
00223 }
00224 
00225 inline void DictionaryBasedBreakIterator::bumpDictionaryCharCount(void) {
00226     ++dictionaryCharCount;
00227 }
00228 U_NAMESPACE_END
00229 
00230 #endif

Generated on Mon Mar 4 23:12:28 2002 for ICU 2.0 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002