ICU 78.3: common/unicode/utfstring.h File Reference

ICU 78.3 78.3

Functions
utfstring.h File Reference

C++ header-only API: C++ string helper functions. More...

`#include "unicode/utypes.h"`
`#include "unicode/utf16.h"`

Go to the source code of this file.

## Functions
template<typename StringClass >
StringClass & | U_HEADER_ONLY_NAMESPACE::utfstring::appendOrFFFD (StringClass &s, UChar32 c)
| Appends the code point to the string. More...
template<typename StringClass >
StringClass & | U_HEADER_ONLY_NAMESPACE::utfstring::appendUnsafe (StringClass &s, UChar32 c)
| Appends the code point to the string. More...
template<typename StringClass >
StringClass | U_HEADER_ONLY_NAMESPACE::utfstring::encodeOrFFFD (UChar32 c)
| Returns the code point as a string of code units. More...
template<typename StringClass >
StringClass | U_HEADER_ONLY_NAMESPACE::utfstring::encodeUnsafe (UChar32 c)
| Returns the code point as a string of code units. More...

## Detailed Description

C++ header-only API: C++ string helper functions.

Definition in file utfstring.h.

## Function Documentation

## ◆ appendOrFFFD()

template<typename StringClass >

StringClass& U_HEADER_ONLY_NAMESPACE::utfstring::appendOrFFFD | ( | StringClass & | s,
|  | UChar32 | c
| ) |  |
| inline

Appends the code point to the string.

Appends the U+FFFD replacement character instead if c is not a scalar value. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  s | The string to append to
  c | The code point to append

Returns
  s

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

See also
  U_IS_SCALAR_VALUE

Definition at line 98 of file utfstring.h.

References U_HEADER_ONLY_NAMESPACE::utfstring::appendOrFFFD().

Referenced by U_HEADER_ONLY_NAMESPACE::utfstring::appendOrFFFD().

## ◆ appendUnsafe()

template<typename StringClass >

StringClass& U_HEADER_ONLY_NAMESPACE::utfstring::appendUnsafe | ( | StringClass & | s,
|  | UChar32 | c
| ) |  |
| inline

Appends the code point to the string.

The code point must be a scalar value; otherwise the behavior is undefined. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  s | The string to append to
  c | The code point to append (must be a scalar value)

Returns
  s

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

See also
  U_IS_SCALAR_VALUE

Definition at line 115 of file utfstring.h.

References U_HEADER_ONLY_NAMESPACE::utfstring::appendUnsafe().

Referenced by U_HEADER_ONLY_NAMESPACE::utfstring::appendUnsafe().

## ◆ encodeOrFFFD()

template<typename StringClass >

StringClass U_HEADER_ONLY_NAMESPACE::utfstring::encodeOrFFFD | ( | UChar32 | c | ) |
| inline

Returns the code point as a string of code units.

Returns the U+FFFD replacement character instead if c is not a scalar value. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  c | The code point

Returns
  the string of c's code units

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

See also
  U_IS_SCALAR_VALUE

Definition at line 131 of file utfstring.h.

References U_HEADER_ONLY_NAMESPACE::utfstring::encodeOrFFFD().

Referenced by U_HEADER_ONLY_NAMESPACE::utfstring::encodeOrFFFD().

## ◆ encodeUnsafe()

template<typename StringClass >

StringClass U_HEADER_ONLY_NAMESPACE::utfstring::encodeUnsafe | ( | UChar32 | c | ) |
| inline

Returns the code point as a string of code units.

The code point must be a scalar value; otherwise the behavior is undefined. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  c | The code point

Returns
  the string of c's code units

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

See also
  U_IS_SCALAR_VALUE

Definition at line 149 of file utfstring.h.

References U_HEADER_ONLY_NAMESPACE::utfstring::encodeUnsafe().

Referenced by U_HEADER_ONLY_NAMESPACE::utfstring::encodeUnsafe().