00001 /* 00002 * Copyright © {1999}, International Business Machines Corporation and others. All Rights Reserved. 00003 ********************************************************************** 00004 * Date Name Description 00005 * 10/22/99 alan Creation. 00006 * 11/11/99 rgillam Complete port from Java. 00007 ********************************************************************** 00008 */ 00009 00010 #ifndef RBBI_H 00011 #define RBBI_H 00012 00013 #include "unicode/utypes.h" 00014 #include "unicode/brkiter.h" 00015 00016 class RuleBasedBreakIteratorTables; 00017 class BreakIterator; 00018 00183 class U_I18N_API RuleBasedBreakIterator : public BreakIterator { 00184 00185 public: 00189 static int8_t IGNORE; 00190 00191 private: 00195 static int16_t START_STATE; 00196 00200 static int16_t STOP_STATE; 00201 00202 protected: 00206 CharacterIterator* text; 00207 00211 RuleBasedBreakIteratorTables* tables; 00212 00213 private: 00217 static char fgClassID; 00218 /* 00219 * HSYS: To be revisited, once the ctor are made public. 00220 */ 00221 protected: 00222 //======================================================================= 00223 // constructors 00224 //======================================================================= 00225 00226 // This constructor uses the udata interface to create a BreakIterator whose 00227 // internal tables live in a memory-mapped file. "image" is a pointer to the 00228 // beginning of that file. 00229 RuleBasedBreakIterator(const void* image); 00230 00231 public: 00236 RuleBasedBreakIterator(const RuleBasedBreakIterator& that); 00237 00238 //======================================================================= 00239 // boilerplate 00240 //======================================================================= 00241 00245 virtual ~RuleBasedBreakIterator(); 00246 00251 RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); 00252 00257 virtual UBool operator==(const BreakIterator& that) const; 00258 00263 UBool operator!=(const BreakIterator& that) const; 00264 00269 virtual BreakIterator* clone(void) const; 00270 00275 virtual int32_t hashCode(void) const; 00276 00280 virtual const UnicodeString& getRules(void) const; 00281 00282 //======================================================================= 00283 // BreakIterator overrides 00284 //======================================================================= 00285 00293 virtual const CharacterIterator& getText(void) const; 00294 00302 virtual CharacterIterator* createText(void) const; 00303 00310 virtual void adoptText(CharacterIterator* newText); 00311 00317 virtual void setText(const UnicodeString& newText); 00318 00327 virtual void setText(const UnicodeString* newText); 00328 00334 virtual int32_t first(void); 00335 00341 virtual int32_t last(void); 00342 00352 virtual int32_t next(int32_t n); 00353 00358 virtual int32_t next(void); 00359 00364 virtual int32_t previous(void); 00365 00372 virtual int32_t following(int32_t offset); 00373 00380 virtual int32_t preceding(int32_t offset); 00381 00389 virtual UBool isBoundary(int32_t offset); 00390 00395 virtual int32_t current(void) const; 00396 00407 inline virtual UClassID getDynamicClassID(void) const; 00408 00419 inline static UClassID getStaticClassID(void); 00420 00421 protected: 00422 //======================================================================= 00423 // implementation 00424 //======================================================================= 00432 virtual int32_t handleNext(void); 00433 00441 virtual int32_t handlePrevious(void); 00442 00448 virtual void reset(void); 00449 00450 private: 00451 00456 RuleBasedBreakIterator(RuleBasedBreakIteratorTables* tables); 00457 00458 friend class BreakIterator; 00459 }; 00460 00461 inline UBool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const { 00462 return !operator==(that); 00463 } 00464 00465 inline UClassID RuleBasedBreakIterator::getDynamicClassID(void) const { 00466 return RuleBasedBreakIterator::getStaticClassID(); 00467 } 00468 00469 inline UClassID RuleBasedBreakIterator::getStaticClassID(void) { 00470 return (UClassID)(&fgClassID); 00471 } 00472 00473 #endif