00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef USETITER_H
00010 #define USETITER_H
00011
00012 #include "unicode/utypes.h"
00013
00014 #if U_SHOW_CPLUSPLUS_API
00015
00016 #include "unicode/uobject.h"
00017 #include "unicode/unistr.h"
00018
00024 U_NAMESPACE_BEGIN
00025
00026 class UnicodeSet;
00027 class UnicodeString;
00028
00067 class U_COMMON_API UnicodeSetIterator U_FINAL : public UObject {
00073 enum { IS_STRING = -1 };
00074
00079 UChar32 codepoint;
00080
00089 UChar32 codepointEnd;
00090
00096 const UnicodeString* string;
00097
00098 public:
00099
00106 UnicodeSetIterator(const UnicodeSet& set);
00107
00114 UnicodeSetIterator();
00115
00120 virtual ~UnicodeSetIterator();
00121
00137 inline UBool isString() const;
00138
00144 inline UChar32 getCodepoint() const;
00145
00152 inline UChar32 getCodepointEnd() const;
00153
00165 const UnicodeString& getString();
00166
00167 #ifndef U_HIDE_DRAFT_API
00168
00177 inline UnicodeSetIterator &skipToStrings() {
00178
00179 range = endRange;
00180 endElement = -1;
00181 nextElement = 0;
00182 return *this;
00183 }
00184 #endif // U_HIDE_DRAFT_API
00185
00208 UBool next();
00209
00229 UBool nextRange();
00230
00238 void reset(const UnicodeSet& set);
00239
00244 void reset();
00245
00251 static UClassID U_EXPORT2 getStaticClassID();
00252
00258 virtual UClassID getDynamicClassID() const override;
00259
00260
00261
00262 private:
00263
00264
00265
00266
00269 const UnicodeSet* set;
00272 int32_t endRange;
00275 int32_t range;
00278 int32_t endElement;
00281 int32_t nextElement;
00284 int32_t nextString;
00287 int32_t stringCount;
00288
00293 UnicodeString *cpString;
00294
00297 UnicodeSetIterator(const UnicodeSetIterator&) = delete;
00298
00301 UnicodeSetIterator& operator=(const UnicodeSetIterator&) = delete;
00302
00305 void loadRange(int32_t range);
00306 };
00307
00308 inline UBool UnicodeSetIterator::isString() const {
00309 return codepoint < 0;
00310 }
00311
00312 inline UChar32 UnicodeSetIterator::getCodepoint() const {
00313 return codepoint;
00314 }
00315
00316 inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
00317 return codepointEnd;
00318 }
00319
00320
00321 U_NAMESPACE_END
00322
00323 #endif
00324
00325 #endif