iosfwd 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. } // std
  75. */
  76. #include <__assert> // all public C++ headers provide the assertion handler
  77. #include <__config>
  78. #include <__fwd/string.h>
  79. #include <__mbstate_t.h>
  80. #include <version>
  81. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  82. # pragma GCC system_header
  83. #endif
  84. _LIBCPP_BEGIN_NAMESPACE_STD
  85. class _LIBCPP_TYPE_VIS ios_base;
  86. template <class _CharT, class _Traits = char_traits<_CharT> >
  87. class _LIBCPP_TEMPLATE_VIS basic_ios;
  88. template <class _CharT, class _Traits = char_traits<_CharT> >
  89. class _LIBCPP_TEMPLATE_VIS basic_streambuf;
  90. template <class _CharT, class _Traits = char_traits<_CharT> >
  91. class _LIBCPP_TEMPLATE_VIS basic_istream;
  92. template <class _CharT, class _Traits = char_traits<_CharT> >
  93. class _LIBCPP_TEMPLATE_VIS basic_ostream;
  94. template <class _CharT, class _Traits = char_traits<_CharT> >
  95. class _LIBCPP_TEMPLATE_VIS basic_iostream;
  96. template <class _CharT, class _Traits = char_traits<_CharT>,
  97. class _Allocator = allocator<_CharT> >
  98. class _LIBCPP_TEMPLATE_VIS basic_stringbuf;
  99. template <class _CharT, class _Traits = char_traits<_CharT>,
  100. class _Allocator = allocator<_CharT> >
  101. class _LIBCPP_TEMPLATE_VIS basic_istringstream;
  102. template <class _CharT, class _Traits = char_traits<_CharT>,
  103. class _Allocator = allocator<_CharT> >
  104. class _LIBCPP_TEMPLATE_VIS basic_ostringstream;
  105. template <class _CharT, class _Traits = char_traits<_CharT>,
  106. class _Allocator = allocator<_CharT> >
  107. class _LIBCPP_TEMPLATE_VIS basic_stringstream;
  108. template <class _CharT, class _Traits = char_traits<_CharT> >
  109. class _LIBCPP_TEMPLATE_VIS basic_filebuf;
  110. template <class _CharT, class _Traits = char_traits<_CharT> >
  111. class _LIBCPP_TEMPLATE_VIS basic_ifstream;
  112. template <class _CharT, class _Traits = char_traits<_CharT> >
  113. class _LIBCPP_TEMPLATE_VIS basic_ofstream;
  114. template <class _CharT, class _Traits = char_traits<_CharT> >
  115. class _LIBCPP_TEMPLATE_VIS basic_fstream;
  116. template <class _CharT, class _Traits = char_traits<_CharT> >
  117. class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
  118. template <class _CharT, class _Traits = char_traits<_CharT> >
  119. class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
  120. typedef basic_ios<char> ios;
  121. #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
  122. typedef basic_ios<wchar_t> wios;
  123. #endif
  124. typedef basic_streambuf<char> streambuf;
  125. typedef basic_istream<char> istream;
  126. typedef basic_ostream<char> ostream;
  127. typedef basic_iostream<char> iostream;
  128. typedef basic_stringbuf<char> stringbuf;
  129. typedef basic_istringstream<char> istringstream;
  130. typedef basic_ostringstream<char> ostringstream;
  131. typedef basic_stringstream<char> stringstream;
  132. typedef basic_filebuf<char> filebuf;
  133. typedef basic_ifstream<char> ifstream;
  134. typedef basic_ofstream<char> ofstream;
  135. typedef basic_fstream<char> fstream;
  136. #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
  137. typedef basic_streambuf<wchar_t> wstreambuf;
  138. typedef basic_istream<wchar_t> wistream;
  139. typedef basic_ostream<wchar_t> wostream;
  140. typedef basic_iostream<wchar_t> wiostream;
  141. typedef basic_stringbuf<wchar_t> wstringbuf;
  142. typedef basic_istringstream<wchar_t> wistringstream;
  143. typedef basic_ostringstream<wchar_t> wostringstream;
  144. typedef basic_stringstream<wchar_t> wstringstream;
  145. typedef basic_filebuf<wchar_t> wfilebuf;
  146. typedef basic_ifstream<wchar_t> wifstream;
  147. typedef basic_ofstream<wchar_t> wofstream;
  148. typedef basic_fstream<wchar_t> wfstream;
  149. #endif
  150. template <class _CharT, class _Traits>
  151. class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
  152. template <class _CharT, class _Traits>
  153. class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstreambuf)) basic_streambuf;
  154. template <class _CharT, class _Traits>
  155. class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistream)) basic_istream;
  156. template <class _CharT, class _Traits>
  157. class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostream)) basic_ostream;
  158. template <class _CharT, class _Traits>
  159. class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wiostream)) basic_iostream;
  160. template <class _CharT, class _Traits, class _Allocator>
  161. class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringbuf)) basic_stringbuf;
  162. template <class _CharT, class _Traits, class _Allocator>
  163. class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistringstream)) basic_istringstream;
  164. template <class _CharT, class _Traits, class _Allocator>
  165. class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostringstream)) basic_ostringstream;
  166. template <class _CharT, class _Traits, class _Allocator>
  167. class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringstream)) basic_stringstream;
  168. template <class _CharT, class _Traits>
  169. class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfilebuf)) basic_filebuf;
  170. template <class _CharT, class _Traits>
  171. class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wifstream)) basic_ifstream;
  172. template <class _CharT, class _Traits>
  173. class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wofstream)) basic_ofstream;
  174. template <class _CharT, class _Traits>
  175. class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfstream)) basic_fstream;
  176. template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
  177. typedef fpos<mbstate_t> streampos;
  178. typedef fpos<mbstate_t> wstreampos;
  179. #ifndef _LIBCPP_HAS_NO_CHAR8_T
  180. typedef fpos<mbstate_t> u8streampos;
  181. #endif
  182. typedef fpos<mbstate_t> u16streampos;
  183. typedef fpos<mbstate_t> u32streampos;
  184. #if defined(_NEWLIB_VERSION)
  185. // On newlib, off_t is 'long int'
  186. typedef long int streamoff; // for char_traits in <string>
  187. #else
  188. typedef long long streamoff; // for char_traits in <string>
  189. #endif
  190. // Include other forward declarations here
  191. template <class _Tp, class _Alloc = allocator<_Tp> >
  192. class _LIBCPP_TEMPLATE_VIS vector;
  193. template <class _CharT, class _Traits>
  194. class __save_flags
  195. {
  196. typedef basic_ios<_CharT, _Traits> __stream_type;
  197. typedef typename __stream_type::fmtflags fmtflags;
  198. __stream_type& __stream_;
  199. fmtflags __fmtflags_;
  200. _CharT __fill_;
  201. __save_flags(const __save_flags&);
  202. __save_flags& operator=(const __save_flags&);
  203. public:
  204. _LIBCPP_INLINE_VISIBILITY
  205. explicit __save_flags(__stream_type& __stream)
  206. : __stream_(__stream),
  207. __fmtflags_(__stream.flags()),
  208. __fill_(__stream.fill())
  209. {}
  210. _LIBCPP_INLINE_VISIBILITY
  211. ~__save_flags()
  212. {
  213. __stream_.flags(__fmtflags_);
  214. __stream_.fill(__fill_);
  215. }
  216. };
  217. _LIBCPP_END_NAMESPACE_STD
  218. #endif // _LIBCPP_IOSFWD