2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
4 * Silicon Graphics Computer Systems, Inc.
9 * This material is provided "as is", with absolutely no warranty expressed
10 * or implied. Any use is at your own risk.
12 * Permission to use or copy this software for any purpose is hereby granted
13 * without fee, provided the above notices are retained on all copies.
14 * Permission to modify the code and to distribute modified code is granted,
15 * provided the above notices are retained, and a notice that the code was
16 * modified is included with the above copyright notice.
22 #ifndef _STLP_INTERNAL_IOS_H
23 # include <stl/_ios.h>
26 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
28 #ifndef _STLP_INTERNAL_STREAMBUF
29 # include <stl/_streambuf.h>
32 #ifndef _STLP_INTERNAL_NUMPUNCT_H
33 # include <stl/_numpunct.h>
38 // basic_ios<>'s non-inline member functions
40 // Public constructor, taking a streambuf.
41 template <class _CharT, class _Traits>
42 basic_ios<_CharT, _Traits>
43 ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
45 _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
50 template <class _CharT, class _Traits>
51 basic_streambuf<_CharT, _Traits>*
52 basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf)
54 basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
60 template <class _CharT, class _Traits>
61 basic_ios<_CharT, _Traits>&
62 basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x)
64 _M_invoke_callbacks(erase_event);
65 _M_copy_state(__x); // Inherited from ios_base.
66 _M_fill = __x._M_fill;
67 _M_tied_ostream = __x._M_tied_ostream;
68 _M_invoke_callbacks(copyfmt_event);
69 // this->_M_set_exception_mask(__x.exceptions()); //Exceptions should copy not simply set. should throw exception if mask&state ==1 ,while copying exception.
70 this->exceptions(__x.exceptions());
73 //#ifndef __SYMBIAN32__ // Moved to src
74 template <class _CharT, class _Traits>
75 locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
77 locale __tmp = ios_base::imbue(__loc);
80 _M_streambuf->pubimbue(__loc);
83 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
84 this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::GetFacetLocaleId()) ;
85 this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::GetFacetLocaleId()) ;
87 this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id) ;
88 this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id) ;
89 #endif //__LIBSTD_CPP_SYMBIAN32_WSD__
90 this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping() ;
93 //#endif // __SYMBIAN32__
94 // Protected constructor and initialization functions. The default
95 // constructor creates an uninitialized basic_ios, and init() initializes
96 // all of the members to the values in Table 89 of the C++ standard.
98 template <class _CharT, class _Traits>
99 basic_ios<_CharT, _Traits>::basic_ios()
101 _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
104 template <class _CharT, class _Traits>
106 basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
109 this->imbue(locale());
111 this->_M_set_exception_mask(ios_base::goodbit);
112 this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
113 ios_base::flags(ios_base::skipws | ios_base::dec);
115 ios_base::precision(6);
116 this->fill(widen(' '));
117 // We don't need to worry about any of the three arrays: they are
118 // initialized correctly in ios_base's constructor.
121 // This is never called except from within a catch clause.
122 template <class _CharT, class _Traits>
123 void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag)
125 this->_M_setstate_nothrow(__flag);
126 if (this->_M_get_exception_mask() & __flag)
132 #endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */
134 #endif /* _STLP_IOS_C */