Movatterモバイル変換


[0]ホーム

URL:


ICU 77.1  77.1
usetiter.h
Go to the documentation of this file.
1 // © 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 
14 #if U_SHOW_CPLUSPLUS_API
15 
16 #include "unicode/uobject.h"
17 #include "unicode/unistr.h"
18 
24 U_NAMESPACE_BEGIN
25 
26 classUnicodeSet;
27 classUnicodeString;
28 
67 classU_COMMON_APIUnicodeSetIterator final :publicUObject {
73 enum { IS_STRING = -1 };
74 
79 UChar32 codepoint;
80 
89 UChar32 codepointEnd;
90 
96 constUnicodeString* string;
97 
98 public:
99 
106 UnicodeSetIterator(constUnicodeSet& set);
107 
114 UnicodeSetIterator();
115 
120 virtual~UnicodeSetIterator();
121 
137 inlineUBool isString()const;
138 
144 inlineUChar32 getCodepoint()const;
145 
152 inlineUChar32 getCodepointEnd()const;
153 
165 constUnicodeString&getString();
166 
176 inlineUnicodeSetIterator &skipToStrings() {
177 // Finish code point/range iteration.
178  range = endRange;
179  endElement = -1;
180  nextElement = 0;
181 return *this;
182  }
183 
206 UBoolnext();
207 
227 UBoolnextRange();
228 
236 voidreset(constUnicodeSet& set);
237 
242 voidreset();
243 
249 staticUClassID U_EXPORT2getStaticClassID();
250 
256 virtualUClassIDgetDynamicClassID()const override;
257 
258 // ======================= PRIVATES ===========================
259 
260 private:
261 
262 // endElement and nextElements are really UChar32's, but we keep
263 // them as signed int32_t's so we can do comparisons with
264 // endElement set to -1. Leave them as int32_t's.
267 constUnicodeSet* set;
270  int32_t endRange;
273  int32_t range;
276  int32_t endElement;
279  int32_t nextElement;
282  int32_t nextString;
285  int32_t stringCount;
286 
291 UnicodeString *cpString;
292 
295 UnicodeSetIterator(constUnicodeSetIterator&) =delete;
296 
299 UnicodeSetIterator& operator=(constUnicodeSetIterator&) =delete;
300 
303 void loadRange(int32_t range);
304 };
305 
306 inlineUBool UnicodeSetIterator::isString() const{
307 return codepoint < 0;
308 }
309 
310 inlineUChar32 UnicodeSetIterator::getCodepoint() const{
311 return codepoint;
312 }
313 
314 inlineUChar32 UnicodeSetIterator::getCodepointEnd() const{
315 return codepointEnd;
316 }
317 
318 
319 U_NAMESPACE_END
320 
321 #endif/* U_SHOW_CPLUSPLUS_API */
322 
323 #endif
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition:uobject.h:223
icu::UnicodeSetIterator
UnicodeSetIterator iterates over the contents of a UnicodeSet.
Definition:usetiter.h:67
icu::UnicodeSetIterator::next
UBool next()
Advances the iteration position to the next element in the set, which can be either a single code poi...
icu::UnicodeSetIterator::UnicodeSetIterator
UnicodeSetIterator(const UnicodeSet &set)
Create an iterator over the given set.
icu::UnicodeSetIterator::reset
void reset()
Resets this iterator to the start of the set.
icu::UnicodeSetIterator::nextRange
UBool nextRange()
Returns the next element in the set, either a code point range or a string.
icu::UnicodeSetIterator::skipToStrings
UnicodeSetIterator & skipToStrings()
Skips over the remaining code points/ranges, if any.
Definition:usetiter.h:176
icu::UnicodeSetIterator::getString
const UnicodeString & getString()
Returns the current string, if isString() returned true.
icu::UnicodeSetIterator::reset
void reset(const UnicodeSet &set)
Sets this iterator to visit the elements of the given set and resets it to the start of that set.
icu::UnicodeSetIterator::getDynamicClassID
virtual UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
icu::UnicodeSetIterator::getStaticClassID
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
icu::UnicodeSetIterator::~UnicodeSetIterator
virtual ~UnicodeSetIterator()
Destructor.
icu::UnicodeSetIterator::UnicodeSetIterator
UnicodeSetIterator()
Create an iterator over nothing.
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition:uniset.h:285
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition:unistr.h:296
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition:umachine.h:427
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition:umachine.h:247
unistr.h
C++ API: Unicode String.
uobject.h
C++ API: Common ICU base class UObject.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition:uobject.h:96
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:315

Generated by doxygen 1.9.1
[8]ページ先頭

©2009-2025 Movatter.jp