usetiter.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 * Copyright (c) 2002-2005, International Business Machines
00004 * Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006 */
00007 #ifndef USETITER_H
00008 #define USETITER_H
00009 
00010 #include "unicode/utypes.h"
00011 #include "unicode/uobject.h"
00012 #include "unicode/unistr.h"
00013 
00019 U_NAMESPACE_BEGIN
00020 
00021 class UnicodeSet;
00022 class UnicodeString;
00023 
00057 class U_COMMON_API UnicodeSetIterator : public UObject {
00058 
00059  protected:
00060 
00067     enum { IS_STRING = -1 };
00068 
00074     UChar32 codepoint;
00075 
00085     UChar32 codepointEnd;
00086 
00093     const UnicodeString* string;
00094 
00095  public:
00096 
00103     UnicodeSetIterator(const UnicodeSet& set);
00104 
00111     UnicodeSetIterator();
00112 
00117     virtual ~UnicodeSetIterator();
00118 
00129     inline UBool isString() const;
00130 
00136     inline UChar32 getCodepoint() const;
00137 
00144     inline UChar32 getCodepointEnd() const;
00145 
00151     inline const UnicodeString& getString() const;
00152 
00172     UBool next();
00173 
00194     UBool nextRange();
00195 
00203     void reset(const UnicodeSet& set);
00204 
00209     void reset();
00210 
00216     static UClassID U_EXPORT2 getStaticClassID();
00217 
00223     virtual UClassID getDynamicClassID() const;
00224 
00225     // ======================= PRIVATES ===========================
00226 
00227  protected:
00228 
00229     // endElement and nextElements are really UChar32's, but we keep
00230     // them as signed int32_t's so we can do comparisons with
00231     // endElement set to -1.  Leave them as int32_t's.
00235     const UnicodeSet* set;
00239     int32_t endRange;
00243     int32_t range;
00247     int32_t endElement;
00251     int32_t nextElement;
00252     //UBool abbreviated;
00256     int32_t nextString;
00260     int32_t stringCount;
00261 
00265     UnicodeSetIterator(const UnicodeSetIterator&); // disallow
00266 
00270     UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow
00271 
00275     virtual void loadRange(int32_t range);
00276 
00277 };
00278 
00279 inline UBool UnicodeSetIterator::isString() const {
00280     return codepoint == (UChar32)IS_STRING;
00281 }
00282 
00283 inline UChar32 UnicodeSetIterator::getCodepoint() const {
00284     return codepoint;
00285 }
00286 
00287 inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
00288     return codepointEnd;
00289 }
00290 
00291 inline const UnicodeString& UnicodeSetIterator::getString() const {
00292     return *string;
00293 }
00294 
00295 U_NAMESPACE_END
00296 
00297 #endif

Generated on Tue Sep 13 11:03:33 2005 for ICU 3.4 by  doxygen 1.4.4