// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (c) 2002-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ #ifndef USETITER_H #define USETITER_H #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API #include "unicode/uobject.h" #include "unicode/unistr.h" /** * \file * \brief C++ API: UnicodeSetIterator iterates over the contents of a UnicodeSet. */ U_NAMESPACE_BEGIN class UnicodeSet; class UnicodeString; /** * * UnicodeSetIterator iterates over the contents of a UnicodeSet. It * iterates over either code points or code point ranges. After all * code points or ranges have been returned, it returns the * multicharacter strings of the UnicodeSet, if any. * * This class is not intended for public subclassing. * * <p>To iterate over code points and strings, use a loop like this: * <pre> * UnicodeSetIterator it(set); * while (it.next()) { * processItem(it.getString()); * } * </pre> * <p>Each item in the set is accessed as a string. Set elements * consisting of single code points are returned as strings containing * just the one code point. * * <p>To iterate over code point ranges, instead of individual code points, * use a loop like this: * <pre> * UnicodeSetIterator it(set); * while (it.nextRange()) { * if (it.isString()) { * processString(it.getString()); * } else { * processCodepointRange(it.getCodepoint(), it.getCodepointEnd()); * } * } * </pre> * * To iterate over only the strings, start with <code>skipToStrings()</code>. * * @author M. Davis * @stable ICU 2.4 */ class U_COMMON_API UnicodeSetIterator final : public UObject { … }; inline UBool UnicodeSetIterator::isString() const { … } inline UChar32 UnicodeSetIterator::getCodepoint() const { … } inline UChar32 UnicodeSetIterator::getCodepointEnd() const { … } U_NAMESPACE_END #endif /* U_SHOW_CPLUSPLUS_API */ #endif