Loading...
Searching...
No Matches
U_HEADER_ONLY_NAMESPACE::USetStrings Class Reference

C++ "range" for iterating over the empty and multi-character strings of a USet. More...

`#include <uset.h>`

## Public Member Functions

| USetStrings (const USet *pUset)
| Constructs a C++ "range" object over the strings of the USet.
| USetStrings (const USetStrings &other)=default
USetStringIterator | begin () const
USetStringIterator | end () const

## Detailed Description

C++ "range" for iterating over the empty and multi-character strings of a USet.

using U_HEADER_NESTED_NAMESPACE::USetStrings;
LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, &errorCode));
for (auto s : USetStrings(uset.getAlias())) {
int32_t len32 = s.length();
char utf8[200];
u_strToUTF8WithSub(utf8, int32_t{sizeof(utf8) - 1}, nullptr,
s.data(), len32, 0xFFFD, nullptr, errorCode);
printf("uset.string length %ld \"%s\"\n", long{len32}, utf8);
}
LocalUSetPointer
"Smart pointer" class, closes a USet via uset_close().
U_HEADER_ONLY_NAMESPACE::USetStrings::USetStrings
USetStrings(const USet *pUset)
Constructs a C++ "range" object over the strings of the USet.
Definition uset.h:1719
uset_openPattern
U_CAPI USet * uset_openPattern(const UChar *pattern, int32_t patternLength, UErrorCode *ec)
Creates a set from the given pattern.
u_strToUTF8WithSub
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 strings().

Stable
  ICU 76

See also
  USetCodePoints
  USetRanges
  USetElements

Definition at line 1713 of file uset.h.

## Constructor & Destructor Documentation

## USetStrings() [1/2]

U_HEADER_ONLY_NAMESPACE::USetStrings::USetStrings | ( | const USet * | pUset | ) |

inline

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

Stable
  ICU 76

Definition at line 1719 of file uset.h.

References uset_getStringCount().

Referenced by USetStrings().

## USetStrings() [2/2]

U_HEADER_ONLY_NAMESPACE::USetStrings::USetStrings | ( | const USetStrings & | other | ) |

default

Stable
  ICU 76

References USetStrings().

## Member Function Documentation

## begin()

USetStringIterator U_HEADER_ONLY_NAMESPACE::USetStrings::begin | ( |  | ) | const

inline

Stable
  ICU 76

Definition at line 1725 of file uset.h.

## end()

USetStringIterator U_HEADER_ONLY_NAMESPACE::USetStrings::end | ( |  | ) | const

inline

Stable
  ICU 76

Definition at line 1730 of file uset.h.

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

- common/unicode/uset.h