cuchar 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // -*- C++ -*- forwarding header.
  2. // Copyright (C) 2015-2022 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file include/cuchar
  21. * This is a Standard C++ Library file. You should @c \#include this file
  22. * in your programs, rather than any of the @a *.h implementation files.
  23. *
  24. * This is the C++ version of the Standard C Library header @c uchar.h,
  25. * and its contents are (mostly) the same as that header, but are all
  26. * contained in the namespace @c std (except for names which are defined
  27. * as macros in C).
  28. */
  29. //
  30. // ISO C++ 14882:2011 21.8
  31. //
  32. #ifndef _GLIBCXX_CUCHAR
  33. #define _GLIBCXX_CUCHAR 1
  34. #pragma GCC system_header
  35. #if __cplusplus < 201103L
  36. # include <bits/c++0x_warning.h>
  37. #else
  38. #include <bits/c++config.h>
  39. #include <cwchar>
  40. #if (_GLIBCXX_USE_C11_UCHAR_CXX11 \
  41. || (_GLIBCXX_USE_CHAR8_T \
  42. && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
  43. || (__cplusplus >= 202002 \
  44. && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20))))
  45. #include <uchar.h>
  46. #endif
  47. // Support for mbrtoc8 and c8rtomb is conditioned on support by the C library.
  48. #if (_GLIBCXX_USE_CHAR8_T \
  49. && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
  50. || (__cplusplus >= 202002 \
  51. && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20)))
  52. #undef mbrtoc8
  53. #undef c8rtomb
  54. namespace std _GLIBCXX_VISIBILITY(default)
  55. {
  56. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  57. using ::mbrtoc8;
  58. using ::c8rtomb;
  59. _GLIBCXX_END_NAMESPACE_VERSION
  60. } // namespace std
  61. #endif // _GLIBCXX_USE_CHAR8_T
  62. #if _GLIBCXX_USE_C11_UCHAR_CXX11
  63. // Get rid of those macros defined in <uchar.h> in lieu of real functions.
  64. #undef mbrtoc16
  65. #undef c16rtomb
  66. #undef mbrtoc32
  67. #undef c32rtomb
  68. namespace std _GLIBCXX_VISIBILITY(default)
  69. {
  70. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  71. using ::mbrtoc16;
  72. using ::c16rtomb;
  73. using ::mbrtoc32;
  74. using ::c32rtomb;
  75. _GLIBCXX_END_NAMESPACE_VERSION
  76. } // namespace std
  77. #endif // _GLIBCXX_USE_C11_UCHAR_CXX11
  78. #endif // C++11
  79. #endif // _GLIBCXX_CUCHAR