ICU 76.1 76.1
U_HEADER_ONLY_NAMESPACE::USetElements Class Reference

A C++ "range" for iterating over all of the elements of a USet. More...

#include <uset.h>

Public Member Functions

 USetElements (const USet *uset)
 Constructs a C++ "range" object over all of the elements of the USet.
 USetElements (const USetElements &other)=default
USetElementIterator begin () const
USetElementIterator end () const

Detailed Description

A C++ "range" for iterating over all of the elements of a USet.

Convenient all-in one iteration, but creates a std::u16string for each code point or string.

Code points are returned first, then empty and multi-character strings.

using U_HEADER_NESTED_NAMESPACE::USetElements;
LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, &errorCode));
for (auto el : USetElements(uset.getAlias())) {
UnicodeString us(el);
std::string u8;
printf("uset.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
}
"Smart pointer" class, closes a USet via uset_close().
USetElements(const USet *uset)
Constructs a C++ "range" object over all of the elements of the USet.
Definition uset.h:1877
U_CAPI USet * uset_openPattern(const UChar *pattern, int32_t patternLength, UErrorCode *ec)
Creates a set from the given pattern.

C++ UnicodeSet has member functions for iteration, including begin() and end().

Returns
an all-elements iterator.
Draft
This API may be changed in the future versions and was introduced in ICU 77
See also
USetCodePoints
USetRanges
USetStrings

Definition at line 1871 of file uset.h.

Constructor & Destructor Documentation

◆ USetElements() [1/2]

U_HEADER_ONLY_NAMESPACE::USetElements::USetElements ( const USet * uset)
inline

Constructs a C++ "range" object over all of the elements of the USet.

Draft
This API may be changed in the future versions and was introduced in ICU 77

Definition at line 1877 of file uset.h.

References uset_getRangeCount(), and uset_getStringCount().

Referenced by USetElements().

◆ USetElements() [2/2]

U_HEADER_ONLY_NAMESPACE::USetElements::USetElements ( const USetElements & other)
default
Draft
This API may be changed in the future versions and was introduced in ICU 77

References USetElements().

Member Function Documentation

◆ begin()

USetElementIterator U_HEADER_ONLY_NAMESPACE::USetElements::begin ( ) const
inline
Draft
This API may be changed in the future versions and was introduced in ICU 77

Definition at line 1885 of file uset.h.

◆ end()

USetElementIterator U_HEADER_ONLY_NAMESPACE::USetElements::end ( ) const
inline
Draft
This API may be changed in the future versions and was introduced in ICU 77

Definition at line 1890 of file uset.h.


The documentation for this class was generated from the following file: