Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

usetiter.h

00001 /*
00002 **********************************************************************
00003 * Copyright (c) 2002-2003, International Business Machines
00004 * Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006 * $Source: /usr/cvs/icu/icu/source/common/unicode/usetiter.h,v $ 
00007 **********************************************************************
00008 */
00009 #ifndef USETITER_H
00010 #define USETITER_H
00011 
00012 #include "unicode/utypes.h"
00013 #include "unicode/uobject.h"
00014 #include "unicode/unistr.h"
00015 
00016 U_NAMESPACE_BEGIN
00017 
00018 class UnicodeSet;
00019 class UnicodeString;
00020 
00053 class U_COMMON_API UnicodeSetIterator : public UObject {
00054 
00055  protected:
00056     
00063     enum { IS_STRING = -1 };
00064 
00070     UChar32 codepoint;
00071 
00081     UChar32 codepointEnd;
00082 
00089     const UnicodeString* string;
00090 
00091  public:
00092 
00099     UnicodeSetIterator(const UnicodeSet& set);
00100         
00107     UnicodeSetIterator();
00108         
00113     virtual ~UnicodeSetIterator();
00114 
00125     inline UBool isString() const;
00126 
00132     inline UChar32 getCodepoint() const;
00133 
00140     inline UChar32 getCodepointEnd() const;
00141 
00147     inline const UnicodeString& getString() const;
00148 
00168     UBool next();
00169         
00190     UBool nextRange();
00191         
00199     void reset(const UnicodeSet& set);
00200         
00205     void reset();
00206     
00212     static UClassID getStaticClassID();
00213 
00219     virtual UClassID getDynamicClassID() const;
00220 
00221     // ======================= PRIVATES ===========================
00222     
00223  protected:
00224 
00225     // endElement and nextElements are really UChar32's, but we keep
00226     // them as signed int32_t's so we can do comparisons with
00227     // endElement set to -1.  Leave them as int32_t's.
00231     const UnicodeSet* set;
00235     int32_t endRange;
00239     int32_t range;
00243     int32_t endElement;
00247     int32_t nextElement;
00248     //UBool abbreviated;
00252     int32_t nextString;
00256     int32_t stringCount;
00257 
00261     UnicodeSetIterator(const UnicodeSetIterator&); // disallow
00262 
00266     UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow
00267 
00271     virtual void loadRange(int32_t range);
00272 
00273 };
00274 
00275 inline UBool UnicodeSetIterator::isString() const {
00276     return codepoint == (UChar32)IS_STRING;
00277 }
00278 
00279 inline UChar32 UnicodeSetIterator::getCodepoint() const {
00280     return codepoint;
00281 }
00282 
00283 inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
00284     return codepointEnd;
00285 }
00286 
00287 inline const UnicodeString& UnicodeSetIterator::getString() const {
00288     return *string;
00289 }
00290 
00291 U_NAMESPACE_END
00292 
00293 #endif

Generated on Wed May 18 17:29:15 2005 for ICU 2.8 by  doxygen 1.4.2