iosfwd 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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/fstream.h>
  79. #include <__fwd/ios.h>
  80. #include <__fwd/istream.h>
  81. #include <__fwd/ostream.h>
  82. #include <__fwd/sstream.h>
  83. #include <__fwd/streambuf.h>
  84. #include <__fwd/string.h>
  85. #include <__std_mbstate_t.h>
  86. #include <version>
  87. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  88. # pragma GCC system_header
  89. #endif
  90. _LIBCPP_BEGIN_NAMESPACE_STD
  91. class _LIBCPP_EXPORTED_FROM_ABI ios_base;
  92. template <class _CharT, class _Traits = char_traits<_CharT> >
  93. class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
  94. template <class _CharT, class _Traits = char_traits<_CharT> >
  95. class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
  96. template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
  97. typedef fpos<mbstate_t> streampos;
  98. #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
  99. typedef fpos<mbstate_t> wstreampos;
  100. #endif
  101. #ifndef _LIBCPP_HAS_NO_CHAR8_T
  102. typedef fpos<mbstate_t> u8streampos;
  103. #endif
  104. typedef fpos<mbstate_t> u16streampos;
  105. typedef fpos<mbstate_t> u32streampos;
  106. // Include other forward declarations here
  107. template <class _Tp, class _Alloc = allocator<_Tp> >
  108. class _LIBCPP_TEMPLATE_VIS vector;
  109. template <class _CharT, class _Traits>
  110. class __save_flags
  111. {
  112. typedef basic_ios<_CharT, _Traits> __stream_type;
  113. typedef typename __stream_type::fmtflags fmtflags;
  114. __stream_type& __stream_;
  115. fmtflags __fmtflags_;
  116. _CharT __fill_;
  117. __save_flags(const __save_flags&);
  118. __save_flags& operator=(const __save_flags&);
  119. public:
  120. _LIBCPP_INLINE_VISIBILITY
  121. explicit __save_flags(__stream_type& __stream)
  122. : __stream_(__stream),
  123. __fmtflags_(__stream.flags()),
  124. __fill_(__stream.fill())
  125. {}
  126. _LIBCPP_INLINE_VISIBILITY
  127. ~__save_flags()
  128. {
  129. __stream_.flags(__fmtflags_);
  130. __stream_.fill(__fill_);
  131. }
  132. };
  133. _LIBCPP_END_NAMESPACE_STD
  134. #endif // _LIBCPP_IOSFWD