iosfwd 12 KB

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