ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 2001-2008 IBM and others. All rights reserved. 00004 ********************************************************************** 00005 * Date Name Description 00006 * 03/22/2000 helena Creation. 00007 ********************************************************************** 00008 */ 00009 00010 #ifndef STSEARCH_H 00011 #define STSEARCH_H 00012 00013 #include "unicode/utypes.h" 00014 00020 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION 00021 00022 #include "unicode/tblcoll.h" 00023 #include "unicode/coleitr.h" 00024 #include "unicode/search.h" 00025 00026 U_NAMESPACE_BEGIN 00027 00138 class U_I18N_API StringSearch : public SearchIterator 00139 { 00140 public: 00141 00142 // public constructors and destructors -------------------------------- 00143 00165 StringSearch(const UnicodeString &pattern, const UnicodeString &text, 00166 const Locale &locale, 00167 BreakIterator *breakiter, 00168 UErrorCode &status); 00169 00191 StringSearch(const UnicodeString &pattern, 00192 const UnicodeString &text, 00193 RuleBasedCollator *coll, 00194 BreakIterator *breakiter, 00195 UErrorCode &status); 00196 00222 StringSearch(const UnicodeString &pattern, CharacterIterator &text, 00223 const Locale &locale, 00224 BreakIterator *breakiter, 00225 UErrorCode &status); 00226 00252 StringSearch(const UnicodeString &pattern, CharacterIterator &text, 00253 RuleBasedCollator *coll, 00254 BreakIterator *breakiter, 00255 UErrorCode &status); 00256 00263 StringSearch(const StringSearch &that); 00264 00270 virtual ~StringSearch(void); 00271 00283 StringSearch *clone() const; 00284 00285 // operator overloading --------------------------------------------- 00286 00293 StringSearch & operator=(const StringSearch &that); 00294 00303 virtual UBool operator==(const SearchIterator &that) const; 00304 00305 // public get and set methods ---------------------------------------- 00306 00320 virtual void setOffset(int32_t position, UErrorCode &status); 00321 00330 virtual int32_t getOffset(void) const; 00331 00343 virtual void setText(const UnicodeString &text, UErrorCode &status); 00344 00359 virtual void setText(CharacterIterator &text, UErrorCode &status); 00360 00370 RuleBasedCollator * getCollator() const; 00371 00382 void setCollator(RuleBasedCollator *coll, UErrorCode &status); 00383 00393 void setPattern(const UnicodeString &pattern, UErrorCode &status); 00394 00400 const UnicodeString & getPattern() const; 00401 00402 // public methods ---------------------------------------------------- 00403 00412 virtual void reset(); 00413 00422 virtual SearchIterator * safeClone(void) const; 00423 00429 virtual UClassID getDynamicClassID() const; 00430 00436 static UClassID U_EXPORT2 getStaticClassID(); 00437 00438 protected: 00439 00440 // protected method ------------------------------------------------- 00441 00464 virtual int32_t handleNext(int32_t position, UErrorCode &status); 00465 00488 virtual int32_t handlePrev(int32_t position, UErrorCode &status); 00489 00490 private : 00491 StringSearch(); // default constructor not implemented 00492 00493 // private data members ---------------------------------------------- 00494 00499 RuleBasedCollator m_collator_; 00504 UnicodeString m_pattern_; 00509 UStringSearch *m_strsrch_; 00510 00511 }; 00512 00513 U_NAMESPACE_END 00514 00515 #endif /* #if !UCONFIG_NO_COLLATION */ 00516 00517 #endif 00518