ICU 77.1  77.1
•All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions
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 *pUset)
 Constructs a C++ "range" object over all of the elements of the USet. More...
 
 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())) {
int32_t len32 = el.length();
char utf8[200];
u_strToUTF8WithSub(utf8, int32_t{sizeof(utf8) - 1}, nullptr,
el.data(), len32, 0xFFFD, nullptr, errorCode);
printf("uset.element length %ld \"%s\"\n", long{len32}, utf8);
}
"Smart pointer" class, closes a USet via uset_close().
USetElements(const USet *pUset)
Constructs a C++ "range" object over all of the elements of the USet.
Definition: uset.h:1881
U_CAPI USet * uset_openPattern(const UChar *pattern, int32_t patternLength, UErrorCode *ec)
Creates a set from the given pattern.
U_CAPI char * u_strToUTF8WithSub(char *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode)
Convert a UTF-16 string to UTF-8.

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 1875 of file uset.h.

Constructor & Destructor Documentation

â—† USetElements() [1/2]

U_HEADER_ONLY_NAMESPACE::USetElements::USetElements ( const USet pUset)
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 1881 of file uset.h.

â—† 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

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 1889 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 1894 of file uset.h.


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