williamr@4: /* williamr@4: * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. williamr@4: * Copyright (c) 1999 williamr@4: * Silicon Graphics Computer Systems, Inc. williamr@4: * williamr@4: * Copyright (c) 1999 williamr@4: * Boris Fomitchev williamr@4: * williamr@4: * This material is provided "as is", with absolutely no warranty expressed williamr@4: * or implied. Any use is at your own risk. williamr@4: * williamr@4: * Permission to use or copy this software for any purpose is hereby granted williamr@4: * without fee, provided the above notices are retained on all copies. williamr@4: * Permission to modify the code and to distribute modified code is granted, williamr@4: * provided the above notices are retained, and a notice that the code was williamr@4: * modified is included with the above copyright notice. williamr@4: * williamr@4: */ williamr@4: #ifndef _STLP_IOS_C williamr@4: #define _STLP_IOS_C williamr@4: williamr@4: #ifndef _STLP_INTERNAL_IOS_H williamr@4: # include williamr@4: #endif williamr@4: williamr@4: #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) williamr@4: williamr@4: #ifndef _STLP_INTERNAL_STREAMBUF williamr@4: # include williamr@4: #endif williamr@4: williamr@4: #ifndef _STLP_INTERNAL_NUMPUNCT_H williamr@4: # include williamr@4: #endif williamr@4: williamr@4: _STLP_BEGIN_NAMESPACE williamr@4: williamr@4: // basic_ios<>'s non-inline member functions williamr@4: williamr@4: // Public constructor, taking a streambuf. williamr@4: template williamr@4: basic_ios<_CharT, _Traits> williamr@4: ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf) williamr@4: : ios_base(), williamr@4: _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) williamr@4: { williamr@4: init(__streambuf); williamr@4: } williamr@4: williamr@4: template williamr@4: basic_streambuf<_CharT, _Traits>* williamr@4: basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) williamr@4: { williamr@4: basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf; williamr@4: _M_streambuf = __buf; williamr@4: this->clear(); williamr@4: return __tmp; williamr@4: } williamr@4: williamr@4: template williamr@4: basic_ios<_CharT, _Traits>& williamr@4: basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) williamr@4: { williamr@4: _M_invoke_callbacks(erase_event); williamr@4: _M_copy_state(__x); // Inherited from ios_base. williamr@4: _M_fill = __x._M_fill; williamr@4: _M_tied_ostream = __x._M_tied_ostream; williamr@4: _M_invoke_callbacks(copyfmt_event); williamr@4: // this->_M_set_exception_mask(__x.exceptions()); //Exceptions should copy not simply set. should throw exception if mask&state ==1 ,while copying exception. williamr@4: this->exceptions(__x.exceptions()); williamr@4: return *this; williamr@4: } williamr@4: //#ifndef __SYMBIAN32__ // Moved to src williamr@4: template williamr@4: locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) williamr@4: { williamr@4: locale __tmp = ios_base::imbue(__loc); williamr@4: williamr@4: if (_M_streambuf) williamr@4: _M_streambuf->pubimbue(__loc); williamr@4: williamr@4: // no throwing here williamr@4: #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) williamr@4: this->_M_cached_ctype = __loc._M_get_facet(ctype::GetFacetLocaleId()) ; williamr@4: this->_M_cached_numpunct = __loc._M_get_facet(numpunct::GetFacetLocaleId()) ; williamr@4: #else williamr@4: this->_M_cached_ctype = __loc._M_get_facet(ctype::id) ; williamr@4: this->_M_cached_numpunct = __loc._M_get_facet(numpunct::id) ; williamr@4: #endif //__LIBSTD_CPP_SYMBIAN32_WSD__ williamr@4: this->_M_cached_grouping = ((numpunct*)_M_cached_numpunct)->grouping() ; williamr@4: return __tmp; williamr@4: } williamr@4: //#endif // __SYMBIAN32__ williamr@4: // Protected constructor and initialization functions. The default williamr@4: // constructor creates an uninitialized basic_ios, and init() initializes williamr@4: // all of the members to the values in Table 89 of the C++ standard. williamr@4: williamr@4: template williamr@4: basic_ios<_CharT, _Traits>::basic_ios() williamr@4: : ios_base(), williamr@4: _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) williamr@4: {} williamr@4: williamr@4: template williamr@4: void williamr@4: basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) williamr@4: { williamr@4: this->rdbuf(__sb); williamr@4: this->imbue(locale()); williamr@4: this->tie(0); williamr@4: this->_M_set_exception_mask(ios_base::goodbit); williamr@4: this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit); williamr@4: ios_base::flags(ios_base::skipws | ios_base::dec); williamr@4: ios_base::width(0); williamr@4: ios_base::precision(6); williamr@4: this->fill(widen(' ')); williamr@4: // We don't need to worry about any of the three arrays: they are williamr@4: // initialized correctly in ios_base's constructor. williamr@4: } williamr@4: williamr@4: // This is never called except from within a catch clause. williamr@4: template williamr@4: void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag) williamr@4: { williamr@4: this->_M_setstate_nothrow(__flag); williamr@4: if (this->_M_get_exception_mask() & __flag) williamr@4: _STLP_RETHROW; williamr@4: } williamr@4: williamr@4: _STLP_END_NAMESPACE williamr@4: williamr@4: #endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */ williamr@4: williamr@4: #endif /* _STLP_IOS_C */