iosfwd 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_IOSFWD
  10. #define _LIBCPP_IOSFWD
  11. /*
  12. iosfwd synopsis
  13. namespace std
  14. {
  15. template<class charT> struct char_traits;
  16. template<> struct char_traits<char>;
  17. template<> struct char_traits<char8_t>; // C++20
  18. template<> struct char_traits<char16_t>;
  19. template<> struct char_traits<char32_t>;
  20. template<> struct char_traits<wchar_t>;
  21. template<class T> class allocator;
  22. class ios_base;
  23. template <class charT, class traits = char_traits<charT> > class basic_ios;
  24. template <class charT, class traits = char_traits<charT> > class basic_streambuf;
  25. template <class charT, class traits = char_traits<charT> > class basic_istream;
  26. template <class charT, class traits = char_traits<charT> > class basic_ostream;
  27. template <class charT, class traits = char_traits<charT> > class basic_iostream;
  28. template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
  29. class basic_stringbuf;
  30. template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
  31. class basic_istringstream;
  32. template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
  33. class basic_ostringstream;
  34. template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
  35. class basic_stringstream;
  36. template <class charT, class traits = char_traits<charT> > class basic_filebuf;
  37. template <class charT, class traits = char_traits<charT> > class basic_ifstream;
  38. template <class charT, class traits = char_traits<charT> > class basic_ofstream;
  39. template <class charT, class traits = char_traits<charT> > class basic_fstream;
  40. template <class charT, class traits = char_traits<charT> > class istreambuf_iterator;
  41. template <class charT, class traits = char_traits<charT> > class ostreambuf_iterator;
  42. typedef basic_ios<char> ios;
  43. typedef basic_ios<wchar_t> wios;
  44. typedef basic_streambuf<char> streambuf;
  45. typedef basic_istream<char> istream;
  46. typedef basic_ostream<char> ostream;
  47. typedef basic_iostream<char> iostream;
  48. typedef basic_stringbuf<char> stringbuf;
  49. typedef basic_istringstream<char> istringstream;
  50. typedef basic_ostringstream<char> ostringstream;
  51. typedef basic_stringstream<char> stringstream;
  52. typedef basic_filebuf<char> filebuf;
  53. typedef basic_ifstream<char> ifstream;
  54. typedef basic_ofstream<char> ofstream;
  55. typedef basic_fstream<char> fstream;
  56. typedef basic_streambuf<wchar_t> wstreambuf;
  57. typedef basic_istream<wchar_t> wistream;
  58. typedef basic_ostream<wchar_t> wostream;
  59. typedef basic_iostream<wchar_t> wiostream;
  60. typedef basic_stringbuf<wchar_t> wstringbuf;
  61. typedef basic_istringstream<wchar_t> wistringstream;
  62. typedef basic_ostringstream<wchar_t> wostringstream;
  63. typedef basic_stringstream<wchar_t> wstringstream;
  64. typedef basic_filebuf<wchar_t> wfilebuf;
  65. typedef basic_ifstream<wchar_t> wifstream;
  66. typedef basic_ofstream<wchar_t> wofstream;
  67. typedef basic_fstream<wchar_t> wfstream;
  68. template <class state> class fpos;
  69. using streampos = fpos<char_traits<char>::state_type>;
  70. using wstreampos = fpos<char_traits<wchar_t>::state_type>;
  71. using u8streampos = fpos<char_traits<char8_t>::state_type>; // C++20
  72. using u16streampos = fpos<char_traits<char16_t>::state_type>;
  73. using u32streampos = fpos<char_traits<char32_t>::state_type>;
  74. template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
  75. class basic_syncbuf; // C++20
  76. using syncbuf = basic_syncbuf<char>; // C++20
  77. using wsyncbuf = basic_syncbuf<wchar_t>; // C++20
  78. template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
  79. class basic_osyncstream; // C++20
  80. using osyncstream = basic_osyncstream<char>; // C++20
  81. using wosyncstream = basic_osyncstream<wchar_t>; // C++20
  82. } // std
  83. */
  84. #include <__config>
  85. #include <__fwd/fstream.h>
  86. #include <__fwd/ios.h>
  87. #include <__fwd/istream.h>
  88. #include <__fwd/ostream.h>
  89. #include <__fwd/sstream.h>
  90. #include <__fwd/streambuf.h>
  91. #include <__fwd/string.h>
  92. #include <__std_mbstate_t.h>
  93. #include <version>
  94. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  95. # pragma GCC system_header
  96. #endif
  97. _LIBCPP_BEGIN_NAMESPACE_STD
  98. class _LIBCPP_EXPORTED_FROM_ABI ios_base;
  99. template <class _CharT, class _Traits = char_traits<_CharT> >
  100. class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
  101. template <class _CharT, class _Traits = char_traits<_CharT> >
  102. class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
  103. template <class _State>
  104. class _LIBCPP_TEMPLATE_VIS fpos;
  105. typedef fpos<mbstate_t> streampos;
  106. #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
  107. typedef fpos<mbstate_t> wstreampos;
  108. #endif
  109. #ifndef _LIBCPP_HAS_NO_CHAR8_T
  110. typedef fpos<mbstate_t> u8streampos;
  111. #endif
  112. typedef fpos<mbstate_t> u16streampos;
  113. typedef fpos<mbstate_t> u32streampos;
  114. #if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
  115. template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
  116. class basic_syncbuf;
  117. using syncbuf = basic_syncbuf<char>;
  118. # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
  119. using wsyncbuf = basic_syncbuf<wchar_t>;
  120. # endif
  121. template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
  122. class basic_osyncstream;
  123. using osyncstream = basic_osyncstream<char>;
  124. # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
  125. using wosyncstream = basic_osyncstream<wchar_t>;
  126. # endif
  127. #endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
  128. // Include other forward declarations here
  129. template <class _Tp, class _Alloc = allocator<_Tp> >
  130. class _LIBCPP_TEMPLATE_VIS vector;
  131. template <class _CharT, class _Traits>
  132. class __save_flags {
  133. typedef basic_ios<_CharT, _Traits> __stream_type;
  134. typedef typename __stream_type::fmtflags fmtflags;
  135. __stream_type& __stream_;
  136. fmtflags __fmtflags_;
  137. _CharT __fill_;
  138. __save_flags(const __save_flags&);
  139. __save_flags& operator=(const __save_flags&);
  140. public:
  141. _LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)
  142. : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
  143. _LIBCPP_HIDE_FROM_ABI ~__save_flags() {
  144. __stream_.flags(__fmtflags_);
  145. __stream_.fill(__fill_);
  146. }
  147. };
  148. _LIBCPP_END_NAMESPACE_STD
  149. #endif // _LIBCPP_IOSFWD