ICU 76.1: common/unicode/char16ptr.h File Reference

ICU 76.1 76.1

Data Structures | Namespaces | Macros | Functions | Variables
char16ptr.h File Reference

C++ API: char16_t pointer wrappers with implicit conversion from bit-compatible raw pointer types. More...

`#include "unicode/utypes.h"`
`#include <cstddef>`
`#include <string_view>`

Go to the source code of this file.

## Data Structures
class | icu::Char16Ptr
| char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. More...
class | icu::ConstChar16Ptr
| const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. More...

## Namespaces
namespace | icu
| File coll.h.

## Macros
#define | U_ALIASING_BARRIER(ptr)
| Barrier for pointer anti-aliasing optimizations even across function boundaries.

## Functions
const UChar * | icu::toUCharPtr (const char16_t *p)
| Converts from const char16_t * to const UChar *.
UChar * | icu::toUCharPtr (char16_t *p)
| Converts from char16_t * to UChar *.
const OldUChar * | icu::toOldUCharPtr (const char16_t *p)
| Converts from const char16_t * to const OldUChar *.
OldUChar * | icu::toOldUCharPtr (char16_t *p)
| Converts from char16_t * to OldUChar *.
std::u16string_view | icu::internal::toU16StringView (std::u16string_view sv)
| Pass-through overload.
std::u16string_view | icu::internal::toU16StringView (std::basic_string_view< uint16_t > sv)
| Basically undefined behavior but sometimes necessary conversion from std::basic_string_view<uint16_t> to std::u16string_view.
template<typename T , typename = typename std::enable_if_t<!std::is_pointer_v<std::remove_reference_t<T>>>>
std::u16string_view | icu::internal::toU16StringViewNullable (const T &text)
| Pass-through overload.
template<typename T , typename = typename std::enable_if_t<std::is_pointer_v<std::remove_reference_t<T>>>, typename = void>
std::u16string_view | icu::internal::toU16StringViewNullable (const T &text)
| In case of nullptr, return an empty view.

## Variables
template<typename T >
constexpr bool | icu::ConvertibleToU16StringView
| Is T convertible to a std::u16string_view or some other 16-bit string view?

## Detailed Description

C++ API: char16_t pointer wrappers with implicit conversion from bit-compatible raw pointer types.

Also conversion functions from char16_t * to UChar * and OldUChar *.

Definition in file char16ptr.h.

## Macro Definition Documentation

## ◆ U_ALIASING_BARRIER

#define U_ALIASING_BARRIER | ( |  | ptr | ) |

Barrier for pointer anti-aliasing optimizations even across function boundaries.

Internal
  Do not use. This API is for internal use only.

Definition at line 36 of file char16ptr.h.

Referenced by icu::UnicodeString::operator std::wstring_view(), icu::toOldUCharPtr(), icu::toOldUCharPtr(), icu::toUCharPtr(), and icu::toUCharPtr().

## Function Documentation

## ◆ toU16StringView() [1/2]

std::u16string_view icu::internal::toU16StringView | ( | std::basic_string_view< uint16_t > | sv | ) |
| inline

Basically undefined behavior but sometimes necessary conversion from std::basic_string_view<uint16_t> to std::u16string_view.

Internal
  Do not use. This API is for internal use only.

Definition at line 339 of file char16ptr.h.

References icu::internal::toU16StringView().

## ◆ toU16StringView() [2/2]

std::u16string_view icu::internal::toU16StringView | ( | std::u16string_view | sv | ) |
| inline

Pass-through overload.

Internal
  Do not use. This API is for internal use only.

Definition at line 331 of file char16ptr.h.

References icu::internal::toU16StringView().

Referenced by icu::internal::toU16StringView(), icu::internal::toU16StringView(), and icu::internal::toU16StringViewNullable().

## ◆ toU16StringViewNullable() [1/2]

template<typename T , typename = typename std::enable_if_t<!std::is_pointer_v<std::remove_reference_t<T>>>>

std::u16string_view icu::internal::toU16StringViewNullable | ( | const T & | text | ) |
| inline

Pass-through overload.

Internal
  Do not use. This API is for internal use only.

Definition at line 361 of file char16ptr.h.

References icu::internal::toU16StringView(), and icu::internal::toU16StringViewNullable().

Referenced by icu::internal::toU16StringViewNullable().

## ◆ toU16StringViewNullable() [2/2]

template<typename T , typename = typename std::enable_if_t<std::is_pointer_v<std::remove_reference_t<T>>>, typename = void>

std::u16string_view icu::internal::toU16StringViewNullable | ( | const T & | text | ) |
| inline

In case of nullptr, return an empty view.

Internal
  Do not use. This API is for internal use only.

Definition at line 372 of file char16ptr.h.

References icu::internal::toU16StringView(), and icu::internal::toU16StringViewNullable().