ICU 58.2 58.2

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

- File List
- Globals

usetiter.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (c) 2002-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 */
9 #ifndef USETITER_H
10 #define USETITER_H
11
12 #include "unicode/utypes.h"
13 #include "unicode/uobject.h"
14 #include "unicode/unistr.h"
15
21 U_NAMESPACE_BEGIN
22
23 class UnicodeSet;
24 class UnicodeString;
25
63 class U_COMMON_API UnicodeSetIterator : public UObject {
64
65 protected:
66
73 enum { IS_STRING = -1 };
74
80 UChar32 codepoint;
81
91 UChar32 codepointEnd;
92
99 const UnicodeString* string;
100
101 public:
102
109 UnicodeSetIterator(const UnicodeSet& set);
110
117 UnicodeSetIterator();
118
123 virtual ~UnicodeSetIterator();
124
140 inline UBool isString() const;
141
147 inline UChar32 getCodepoint() const;
148
155 inline UChar32 getCodepointEnd() const;
156
168 const UnicodeString& getString();
169
192 UBool next();
193
213 UBool nextRange();
214
222 void reset(const UnicodeSet& set);
223
228 void reset();
229
235 static UClassID U_EXPORT2 getStaticClassID();
236
242 virtual UClassID getDynamicClassID() const;
243
244 // ======================= PRIVATES ===========================
245
246 protected:
247
248 // endElement and nextElements are really UChar32's, but we keep
249 // them as signed int32_t's so we can do comparisons with
250 // endElement set to -1. Leave them as int32_t's.
254 const UnicodeSet* set;
258 int32_t endRange;
262 int32_t range;
266 int32_t endElement;
270 int32_t nextElement;
271 //UBool abbreviated;
275 int32_t nextString;
279 int32_t stringCount;
280
286 UnicodeString *cpString;
287
291 UnicodeSetIterator(const UnicodeSetIterator&); // disallow
292
296 UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow
297
301 virtual void loadRange(int32_t range);
302
303 };
304
305 inline UBool UnicodeSetIterator::isString() const {
306 return codepoint == (UChar32)IS_STRING;
307 }
308
309 inline UChar32 UnicodeSetIterator::getCodepoint() const {
310 return codepoint;
311 }
312
313 inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
314 return codepointEnd;
315 }
316
317
318 U_NAMESPACE_END
319
320 #endif
icu::UnicodeSetIterator::string
const UnicodeString * string
If codepoint == IS_STRING, then string points to the current string.
Definition: usetiter.h:99
icu::UnicodeSetIterator::codepoint
UChar32 codepoint
Current code point, or the special value IS_STRING, if the iterator points to a string.
Definition: usetiter.h:80
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man&#39;s RTTI", returns a UClassID for the actual ICU class.
icu::UnicodeSetIterator::isString
UBool isString() const
Returns true if the current element is a string.
Definition: usetiter.h:305
icu::UnicodeSetIterator::nextString
int32_t nextString
Next string.
Definition: usetiter.h:275
unistr.h
C++ API: Unicode String.
icu::UnicodeSetIterator
UnicodeSetIterator iterates over the contents of a UnicodeSet.
Definition: usetiter.h:63
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:93
icu::UnicodeSetIterator::codepointEnd
UChar32 codepointEnd
When iterating over ranges using nextRange(), codepointEnd contains the inclusive end of the iteratio...
Definition: usetiter.h:91
icu::UnicodeSetIterator::endElement
int32_t endElement
End element.
Definition: usetiter.h:266
icu::UnicodeSetIterator::range
int32_t range
Range.
Definition: usetiter.h:262
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:357
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:286
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition: uniset.h:278
uobject.h
C++ API: Common ICU base class UObject.
icu::UnicodeSetIterator::getCodepointEnd
UChar32 getCodepointEnd() const
Returns the end of the current code point range, if isString() returned false and nextRange() was cal...
Definition: usetiter.h:313
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
icu::UnicodeSetIterator::endRange
int32_t endRange
End range.
Definition: usetiter.h:258
icu::UnicodeSetIterator::stringCount
int32_t stringCount
String count.
Definition: usetiter.h:279
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:359
icu::UnicodeSetIterator::nextElement
int32_t nextElement
Next element.
Definition: usetiter.h:270
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::UnicodeSetIterator::getCodepoint
UChar32 getCodepoint() const
Returns the current code point, if isString() returned false.
Definition: usetiter.h:309
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259