| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef _LIBCPP___FWD_STRING_H |
| 10 |
#define _LIBCPP___FWD_STRING_H |
| 11 |
|
| 12 |
#include <__config> |
| 13 |
#include <__fwd/memory.h> |
| 14 |
#include <__fwd/memory_resource.h> |
| 15 |
|
| 16 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 |
# pragma GCC system_header |
| 18 |
#endif |
| 19 |
|
| 20 |
_LIBCPP_BEGIN_NAMESPACE_STD |
| 21 |
|
| 22 |
template <class _CharT> |
| 23 |
struct _LIBCPP_TEMPLATE_VIS char_traits; |
| 24 |
template <> |
| 25 |
struct char_traits<char>; |
| 26 |
|
| 27 |
#ifndef _LIBCPP_HAS_NO_CHAR8_T |
| 28 |
template <> |
| 29 |
struct char_traits<char8_t>; |
| 30 |
#endif |
| 31 |
|
| 32 |
template <> |
| 33 |
struct char_traits<char16_t>; |
| 34 |
template <> |
| 35 |
struct char_traits<char32_t>; |
| 36 |
|
| 37 |
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 38 |
template <> |
| 39 |
struct char_traits<wchar_t>; |
| 40 |
#endif |
| 41 |
|
| 42 |
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > |
| 43 |
class _LIBCPP_TEMPLATE_VIS basic_string; |
| 44 |
|
| 45 |
using string = basic_string<char>; |
| 46 |
|
| 47 |
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 48 |
using wstring = basic_string<wchar_t>; |
| 49 |
#endif |
| 50 |
|
| 51 |
#ifndef _LIBCPP_HAS_NO_CHAR8_T |
| 52 |
using u8string = basic_string<char8_t>; |
| 53 |
#endif |
| 54 |
|
| 55 |
using u16string = basic_string<char16_t>; |
| 56 |
using u32string = basic_string<char32_t>; |
| 57 |
|
| 58 |
#if _LIBCPP_STD_VER >= 17 |
| 59 |
|
| 60 |
namespace pmr { |
| 61 |
template <class _CharT, class _Traits = char_traits<_CharT>> |
| 62 |
using basic_string _LIBCPP_AVAILABILITY_PMR = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; |
| 63 |
|
| 64 |
using string _LIBCPP_AVAILABILITY_PMR = basic_string<char>; |
| 65 |
|
| 66 |
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 67 |
using wstring _LIBCPP_AVAILABILITY_PMR = basic_string<wchar_t>; |
| 68 |
# endif |
| 69 |
|
| 70 |
# ifndef _LIBCPP_HAS_NO_CHAR8_T |
| 71 |
using u8string _LIBCPP_AVAILABILITY_PMR = basic_string<char8_t>; |
| 72 |
# endif |
| 73 |
|
| 74 |
using u16string _LIBCPP_AVAILABILITY_PMR = basic_string<char16_t>; |
| 75 |
using u32string _LIBCPP_AVAILABILITY_PMR = basic_string<char32_t>; |
| 76 |
} // namespace pmr |
| 77 |
|
| 78 |
#endif // _LIBCPP_STD_VER >= 17 |
| 79 |
|
| 80 |
// clang-format off |
| 81 |
template <class _CharT, class _Traits, class _Allocator> |
| 82 |
class _LIBCPP_PREFERRED_NAME(string) |
| 83 |
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 84 |
_LIBCPP_PREFERRED_NAME(wstring) |
| 85 |
#endif |
| 86 |
#ifndef _LIBCPP_HAS_NO_CHAR8_T |
| 87 |
_LIBCPP_PREFERRED_NAME(u8string) |
| 88 |
#endif |
| 89 |
_LIBCPP_PREFERRED_NAME(u16string) |
| 90 |
_LIBCPP_PREFERRED_NAME(u32string) |
| 91 |
#if _LIBCPP_STD_VER >= 17 |
| 92 |
_LIBCPP_PREFERRED_NAME(pmr::string) |
| 93 |
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
| 94 |
_LIBCPP_PREFERRED_NAME(pmr::wstring) |
| 95 |
# endif |
| 96 |
# ifndef _LIBCPP_HAS_NO_CHAR8_T |
| 97 |
_LIBCPP_PREFERRED_NAME(pmr::u8string) |
| 98 |
# endif |
| 99 |
_LIBCPP_PREFERRED_NAME(pmr::u16string) |
| 100 |
_LIBCPP_PREFERRED_NAME(pmr::u32string) |
| 101 |
#endif |
| 102 |
basic_string; |
| 103 |
// clang-format on |
| 104 |
|
| 105 |
_LIBCPP_END_NAMESPACE_STD |
| 106 |
|
| 107 |
#endif // _LIBCPP___FWD_STRING_H |