ICU 56.1: usetiter.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

usetiter.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (c) 2002-2014, 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
19 U_NAMESPACE_BEGIN
20
21 class UnicodeSet;
22 class UnicodeString;
23
61 class U_COMMON_API UnicodeSetIterator : public UObject {
62
63 protected:
64
71 enum { IS_STRING = -1 };
72
78 UChar32 codepoint;
79
89 UChar32 codepointEnd;
90
97 const UnicodeString* string;
98
99 public:
100
107 UnicodeSetIterator(const UnicodeSet& set);
108
115 UnicodeSetIterator();
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
284 UnicodeString *cpString;
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
316 U_NAMESPACE_END
317
318 #endif
icu::UnicodeSetIterator::string
const UnicodeString * string
If codepoint == IS_STRING, then string points to the current string.
Definition: usetiter.h:97
icu::UnicodeSetIterator::codepoint
UChar32 codepoint
Current code point, or the special value IS_STRING, if the iterator points to a string.
Definition: usetiter.h:78
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
icu::UnicodeSetIterator::nextString
int32_t nextString
Next string.
Definition: usetiter.h:273
unistr.h
C++ API: Unicode String.
icu::UnicodeSetIterator
UnicodeSetIterator iterates over the contents of a UnicodeSet.
Definition: usetiter.h:61
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
icu::UnicodeSetIterator::codepointEnd
UChar32 codepointEnd
When iterating over ranges using nextRange(), codepointEnd contains the inclusive end of the iteratio...
Definition: usetiter.h:89
icu::UnicodeSetIterator::endElement
int32_t endElement
End element.
Definition: usetiter.h:264
icu::UnicodeSetIterator::set
const UnicodeSet * set
The set.
Definition: usetiter.h:252
icu::UnicodeSetIterator::range
int32_t range
Range.
Definition: usetiter.h:260
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
icu::UnicodeSetIterator::cpString
UnicodeString * cpString
Points to the string to use when the caller asks for a string and the current iteration item is a cod...
Definition: usetiter.h:284
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition: uniset.h:276
uobject.h
C++ API: Common ICU base class UObject.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
icu::UnicodeSetIterator::endRange
int32_t endRange
End range.
Definition: usetiter.h:256
icu::UnicodeSetIterator::stringCount
int32_t stringCount
String count.
Definition: usetiter.h:277
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:357
icu::UnicodeSetIterator::nextElement
int32_t nextElement
Next element.
Definition: usetiter.h:268
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:293
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234