ICU 73.2  73.2
stsearch.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 **********************************************************************
00005 *   Copyright (C) 2001-2014 IBM and others. All rights reserved.
00006 **********************************************************************
00007 *   Date        Name        Description
00008 *  03/22/2000   helena      Creation.
00009 **********************************************************************
00010 */
00011 
00012 #ifndef STSEARCH_H
00013 #define STSEARCH_H
00014 
00015 #include "unicode/utypes.h"
00016 
00017 #if U_SHOW_CPLUSPLUS_API
00018 
00024 #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
00025 
00026 #include "unicode/tblcoll.h"
00027 #include "unicode/coleitr.h"
00028 #include "unicode/search.h"
00029 
00030 U_NAMESPACE_BEGIN
00031 
00135 class U_I18N_API StringSearch final : public SearchIterator
00136 {
00137 public:
00138 
00139     // public constructors and destructors --------------------------------
00140 
00162     StringSearch(const UnicodeString &pattern, const UnicodeString &text,
00163                  const Locale        &locale,       
00164                        BreakIterator *breakiter,
00165                        UErrorCode    &status);
00166 
00188     StringSearch(const UnicodeString     &pattern, 
00189                  const UnicodeString     &text,
00190                        RuleBasedCollator *coll,       
00191                        BreakIterator     *breakiter,
00192                        UErrorCode        &status);
00193 
00219     StringSearch(const UnicodeString &pattern, CharacterIterator &text,
00220                  const Locale        &locale, 
00221                        BreakIterator *breakiter,
00222                        UErrorCode    &status);
00223 
00249     StringSearch(const UnicodeString     &pattern, CharacterIterator &text,
00250                        RuleBasedCollator *coll, 
00251                        BreakIterator     *breakiter,
00252                        UErrorCode        &status);
00253 
00260     StringSearch(const StringSearch &that);
00261 
00267     virtual ~StringSearch(void);
00268 
00280     StringSearch *clone() const;
00281 
00282     // operator overloading ---------------------------------------------
00283 
00290     StringSearch & operator=(const StringSearch &that);
00291 
00300     virtual bool operator==(const SearchIterator &that) const override;
00301 
00302     // public get and set methods ----------------------------------------
00303 
00317     virtual void setOffset(int32_t position, UErrorCode &status) override;
00318 
00327     virtual int32_t getOffset(void) const override;
00328 
00340     virtual void setText(const UnicodeString &text, UErrorCode &status) override;
00341     
00356     virtual void setText(CharacterIterator &text, UErrorCode &status) override;
00357 
00367     RuleBasedCollator * getCollator() const;
00368     
00377     void setCollator(RuleBasedCollator *coll, UErrorCode &status);
00378     
00387     void setPattern(const UnicodeString &pattern, UErrorCode &status);
00388     
00394     const UnicodeString & getPattern() const;
00395 
00396     // public methods ----------------------------------------------------
00397 
00406     virtual void reset() override;
00407 
00416     virtual StringSearch * safeClone() const override;
00417     
00423     virtual UClassID getDynamicClassID() const override;
00424 
00430     static UClassID U_EXPORT2 getStaticClassID();
00431 
00432 protected:
00433 
00434     // protected method -------------------------------------------------
00435 
00458     virtual int32_t handleNext(int32_t position, UErrorCode &status) override;
00459 
00482     virtual int32_t handlePrev(int32_t position, UErrorCode &status) override;
00483     
00484 private :
00485     StringSearch() = delete; // default constructor not implemented
00486 
00487     // private data members ----------------------------------------------
00488 
00493     UnicodeString      m_pattern_;
00498     UStringSearch     *m_strsrch_;
00499 
00500 };
00501 
00502 U_NAMESPACE_END
00503 
00504 #endif /* #if !UCONFIG_NO_COLLATION */
00505 
00506 #endif /* U_SHOW_CPLUSPLUS_API */
00507 
00508 #endif
00509