ICU 50.1.2  50.1.2
stsearch.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 2001-2008 IBM and others. All rights reserved.
4 **********************************************************************
5 * Date Name Description
6 * 03/22/2000 helena Creation.
7 **********************************************************************
8 */
9 
10 #ifndef STSEARCH_H
11 #define STSEARCH_H
12 
13 #include "unicode/utypes.h"
14 
20 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
21 
22 #include "unicode/tblcoll.h"
23 #include "unicode/coleitr.h"
24 #include "unicode/search.h"
25 
27 
139 {
140 public:
141 
142  // public constructors and destructors --------------------------------
143 
165  StringSearch(const UnicodeString &pattern, const UnicodeString &text,
166  const Locale &locale,
167  BreakIterator *breakiter,
168  UErrorCode &status);
169 
191  StringSearch(const UnicodeString &pattern,
192  const UnicodeString &text,
193  RuleBasedCollator *coll,
194  BreakIterator *breakiter,
195  UErrorCode &status);
196 
222  StringSearch(const UnicodeString &pattern, CharacterIterator &text,
223  const Locale &locale,
224  BreakIterator *breakiter,
225  UErrorCode &status);
226 
252  StringSearch(const UnicodeString &pattern, CharacterIterator &text,
253  RuleBasedCollator *coll,
254  BreakIterator *breakiter,
255  UErrorCode &status);
256 
263  StringSearch(const StringSearch &that);
264 
270  virtual ~StringSearch(void);
271 
283  StringSearch *clone() const;
284 
285  // operator overloading ---------------------------------------------
286 
293  StringSearch & operator=(const StringSearch &that);
294 
303  virtual UBool operator==(const SearchIterator &that) const;
304 
305  // public get and set methods ----------------------------------------
306 
320  virtual void setOffset(int32_t position, UErrorCode &status);
321 
330  virtual int32_t getOffset(void) const;
331 
343  virtual void setText(const UnicodeString &text, UErrorCode &status);
344 
359  virtual void setText(CharacterIterator &text, UErrorCode &status);
360 
370  RuleBasedCollator * getCollator() const;
371 
382  void setCollator(RuleBasedCollator *coll, UErrorCode &status);
383 
393  void setPattern(const UnicodeString &pattern, UErrorCode &status);
394 
400  const UnicodeString & getPattern() const;
401 
402  // public methods ----------------------------------------------------
403 
412  virtual void reset();
413 
422  virtual SearchIterator * safeClone(void) const;
423 
429  virtual UClassID getDynamicClassID() const;
430 
436  static UClassID U_EXPORT2 getStaticClassID();
437 
438 protected:
439 
440  // protected method -------------------------------------------------
441 
464  virtual int32_t handleNext(int32_t position, UErrorCode &status);
465 
488  virtual int32_t handlePrev(int32_t position, UErrorCode &status);
489 
490 private :
491  StringSearch(); // default constructor not implemented
492 
493  // private data members ----------------------------------------------
494 
499  RuleBasedCollator m_collator_;
504  UnicodeString m_pattern_;
509  UStringSearch *m_strsrch_;
510 
511 };
512 
514 
515 #endif /* #if !UCONFIG_NO_COLLATION */
516 
517 #endif
518