ICU 51.2  51.2
usetiter.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (c) 2002-2008, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 */
7 #ifndef USETITER_H
8 #define USETITER_H
9 
10 #include "unicode/utypes.h"
11 #include "unicode/uobject.h"
12 #include "unicode/unistr.h"
13 
20 
21 class UnicodeSet;
22 class UnicodeString;
23 
62 
63  protected:
64 
71  enum { IS_STRING = -1 };
72 
79 
90 
98 
99  public:
100 
107  UnicodeSetIterator(const UnicodeSet& set);
108 
116 
121  virtual ~UnicodeSetIterator();
122 
138  inline UBool isString() const;
139 
145  inline UChar32 getCodepoint() const;
146 
153  inline UChar32 getCodepointEnd() const;
154 
166  const UnicodeString& getString();
167 
190  UBool next();
191 
211  UBool nextRange();
212 
220  void reset(const UnicodeSet& set);
221 
226  void reset();
227 
233  static UClassID U_EXPORT2 getStaticClassID();
234 
240  virtual UClassID getDynamicClassID() const;
241 
242  // ======================= PRIVATES ===========================
243 
244  protected:
245 
246  // endElement and nextElements are really UChar32's, but we keep
247  // them as signed int32_t's so we can do comparisons with
248  // endElement set to -1. Leave them as int32_t's.
252  const UnicodeSet* set;
256  int32_t endRange;
260  int32_t range;
264  int32_t endElement;
268  int32_t nextElement;
269  //UBool abbreviated;
273  int32_t nextString;
277  int32_t stringCount;
278 
285 
289  UnicodeSetIterator(const UnicodeSetIterator&); // disallow
290 
294  UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow
295 
299  virtual void loadRange(int32_t range);
300 
301 };
302 
303 inline UBool UnicodeSetIterator::isString() const {
304  return codepoint == (UChar32)IS_STRING;
305 }
306 
307 inline UChar32 UnicodeSetIterator::getCodepoint() const {
308  return codepoint;
309 }
310 
311 inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
312  return codepointEnd;
313 }
314 
315 
317 
318 #endif