30#ifndef _RWSTD_RW_BASIC_IOS_H_INCLUDED
31#define _RWSTD_RW_BASIC_IOS_H_INCLUDED
35# pragma GCC system_header
39#ifndef _RWSTD_NO_REDUNDANT_DEFINITIONS
45#ifndef _RWSTD_RW_IOSBASE_H_INCLUDED
49#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
56#ifndef _RWSTD_IOSFWD_INCLUDED
59template <
class _CharT,
class _Traits =
char_traits<_CharT> >
62typedef basic_ios<char> ios;
64# ifndef _RWSTD_NO_WCHAR_T
66typedef basic_ios<wchar_t> wios;
73template <
class _CharT,
class _Traits>
74class basic_ios:
public ios_base
78 typedef _CharT char_type;
79 typedef _Traits traits_type;
80 typedef typename traits_type::int_type int_type;
81 typedef typename traits_type::pos_type pos_type;
82 typedef typename traits_type::int_type off_type;
86 typedef basic_streambuf<char_type, traits_type> streambuf_type;
87 typedef basic_ostream<char_type, traits_type> ostream_type;
93 explicit basic_ios (streambuf_type *__sb) {
99#ifndef _RWSTD_NO_EXT_IOS_SAFE_CONVERSION
103# if !defined (__INTEL_COMPILER) || !defined (_WIN32)
107 struct _C_uniq_type {
int _C_foo; };
108 typedef int _C_uniq_type::*_C_uniq_ptr;
113 struct _C_uniq_type {
void _C_foo () { }; };
114 typedef void (_C_uniq_type::*_C_uniq_ptr)();
120 operator _C_uniq_ptr ()
const {
121 return fail () ? _C_uniq_ptr (0) : &_C_uniq_type::_C_foo;
126 operator void*()
const {
127 return fail () ? (
void*)0 : (
void*)1;
133 bool operator! ()
const {
138 iostate rdstate ()
const {
139 return iostate (_C_state);
143 void clear (iostate __state =
goodbit) {
144 _C_set (__state, _C_except, rdbuf ());
148 void setstate (iostate __st) {
149 clear (rdstate () | __st);
159 return 0 != (rdstate () &
eofbit);
169 return 0 != (rdstate () &
badbit);
173 iostate exceptions ()
const {
174 return iostate (_C_except);
178 void exceptions (iostate __state) {
179 _C_set (rdstate (), __state, rdbuf ());
183 ostream_type*
tie ()
const {
188 ostream_type*
tie (ostream_type *__strm) {
194 streambuf_type* rdbuf ()
const {
199 streambuf_type* rdbuf (streambuf_type *__rdbuf) {
201 _C_set (
goodbit, _C_except, __rdbuf));
205 basic_ios& copyfmt (
const basic_ios &__x) {
206 return _C_copyfmt (__x, &_C_fill, &__x._C_fill,
sizeof _C_fill), *
this;
210 char_type
fill ()
const;
213 char_type
fill (char_type);
216 locale imbue (
const locale&);
219 char narrow (char_type __c,
char __dflt)
const {
220 return _USE_FACET (ctype<char_type>, getloc ()).narrow (__c, __dflt);
224 char_type
widen (
char __c)
const {
225 return _USE_FACET (ctype<char_type>, getloc ()).widen (__c);
235 void init (streambuf_type*);
239 _RW::__rw_mutex* _C_bufmutex ()
const;
243 basic_ios (
const basic_ios&);
244 basic_ios& operator= (
const basic_ios&);
250template<
class _CharT,
class _Traits>
251inline typename basic_ios<_CharT, _Traits>::char_type
252basic_ios<_CharT, _Traits>::fill ()
const
258 if (traits_type::eq_int_type (traits_type::eof (), _C_fill))
261 return traits_type::to_char_type (_C_fill);
265template<
class _CharT,
class _Traits>
266inline typename basic_ios<_CharT, _Traits>::char_type
267basic_ios<_CharT, _Traits>::fill (char_type __ch)
270 const int_type __c = traits_type::to_int_type (__ch);
275 traits_type::assign (__ch, traits_type::to_char_type (_C_fill));
283template<
class _CharT,
class _Traits>
285basic_ios<_CharT, _Traits>::imbue (
const locale& __loc)
289 const locale __tmp = _C_unsafe_imbue (__loc);
292 rdbuf ()->pubimbue (__loc);
298template<
class _CharT,
class _Traits>
300basic_ios<_CharT, _Traits>::init (streambuf_type *__sb)
308 _C_fill = traits_type::eof ();
314template<
class _CharT,
class _Traits>
315inline _RW::__rw_mutex*
316basic_ios<_CharT, _Traits>::_C_bufmutex ()
const
318#if !defined (_RWSTD_REENTRANT) || defined (_RWSTD_NO_EXT_REENTRANT_IO)
322 return rdbuf () ? &rdbuf ()->_C_mutex : 0;
329 ? 0 : &rdbuf ()->_C_mutex;
338#if _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_IOS)
344# pragma warning (push)
345# pragma warning (disable: 4231)
351#if _RWSTD_INSTANTIATE (_BASIC_IOS, _CHAR)
354 basic_ios<
char, char_traits<char> >);
358#if _RWSTD_INSTANTIATE (_BASIC_IOS, _WCHAR_T)
361 basic_ios<
wchar_t, char_traits<wchar_t> >);
369# pragma warning (pop)
373#if _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_IOS)
const char * widen(char *dst, const char *src)
const char * narrow(char *dst, const char *src)
void tie(std::ostringstream *ps, std::size_t n)
#define _RWSTD_INSTANTIATE_2(a1, a2)
#define _RWSTD_IOS_NOLOCKBUF
#define _RWSTD_IOS_NOLOCK
#define _RWSTD_STATIC_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _USE_FACET(type, arg)
#define _RWSTD_MT_GUARD(ignore)
#define _RWSTD_CONST_CAST(T, x)