Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

rbbi_tbl.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1999 IBM Corp. All rights reserved.
00004 **********************************************************************
00005 *   Date        Name        Description
00006 *   11/11/99    rgillam     Complete port from Java.
00007 **********************************************************************
00008 */
00009 
00010 #ifndef RBBI_TBL_H
00011 #define RBBI_TBL_H
00012 
00013 #include "unicode/utypes.h"
00014 #include "unicode/unistr.h"
00015 #include "unicode/brkiter.h"
00016 #include "unicode/udata.h"
00017 #include "filestrm.h"
00018 
00019 U_CDECL_BEGIN
00020 #ifndef UCMP8_H
00021 typedef struct _CompactByteArray CompactByteArray;
00022 #endif
00023 U_CDECL_END
00024 
00025 /* forward declarations */
00026 class RuleBasedBreakIterator;
00027 class DictionaryBasedBreakIterator;
00028 
00038 class RuleBasedBreakIteratorTables {
00039 
00040 private:
00044     int16_t refCount;
00045 
00046 protected:
00051     UBool ownTables;
00052 
00053 private:
00057     UnicodeString description;
00058 
00062     CompactByteArray* charCategoryTable;
00063 
00067     int16_t* stateTable;
00068 
00073     int16_t* backwardsStateTable;
00074 
00079     int8_t* endStates;
00080 
00085     int8_t* lookaheadStates;
00086 
00091     int32_t numCategories;
00092 
00093     //=======================================================================
00094     // constructor
00095     //=======================================================================
00096 
00100 protected:
00101     RuleBasedBreakIteratorTables();
00102     
00103     RuleBasedBreakIteratorTables(UDataMemory* memory);
00104     UDataMemory *fMemory;
00105 
00106 private:
00111     RuleBasedBreakIteratorTables(const RuleBasedBreakIteratorTables& that);
00112 
00113     //=======================================================================
00114     // boilerplate
00115     //=======================================================================
00116 
00117 protected:
00121     virtual ~RuleBasedBreakIteratorTables();
00122 
00123 private:
00128     RuleBasedBreakIteratorTables& operator=(const RuleBasedBreakIteratorTables& that);
00129 
00134     virtual UBool operator==(const RuleBasedBreakIteratorTables& that) const;
00135 
00140     UBool operator!=(const RuleBasedBreakIteratorTables& that) const;
00141 
00146     virtual int32_t hashCode(void) const;
00147 
00151     const UnicodeString& getRules(void) const;
00152 
00153     //=======================================================================
00154     // reference counting
00155     //=======================================================================
00156     
00160     void addReference(void);
00161 
00165     void removeReference(void);
00166 
00167 protected:
00168     //=======================================================================
00169     // implementation
00170     //=======================================================================
00175     virtual int32_t lookupCategory(UChar c, BreakIterator* bi) const;
00176 
00181     virtual int32_t lookupState(int32_t state, int32_t category) const;
00182 
00187     virtual int32_t lookupBackwardState(int32_t state, int32_t category) const;
00188 
00192     virtual UBool isEndState(int32_t state) const;
00193 
00197     virtual UBool isLookaheadState(int32_t state) const;
00198 
00199     friend class RuleBasedBreakIterator;
00200     friend class DictionaryBasedBreakIterator;
00201 };
00202 
00203 inline UBool
00204 RuleBasedBreakIteratorTables::operator!=(const RuleBasedBreakIteratorTables& that) const {
00205     return !operator==(that);
00206 }
00207 
00208 inline const UnicodeString&
00209 RuleBasedBreakIteratorTables::getRules(void) const {
00210     return description;
00211 }
00212 
00213 inline void
00214 RuleBasedBreakIteratorTables::addReference(void) {
00215     ++refCount;
00216 }
00217 
00218 inline void
00219 RuleBasedBreakIteratorTables::removeReference(void) {
00220     if (--refCount <= 0)
00221         delete this;
00222 }
00223 
00224 #endif

Generated at Tue Dec 5 17:55:30 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000