1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_ios.c Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_ios.c Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,21 +1,22 @@
1.4 /*
1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.6 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.7 + *
1.8 * Copyright (c) 1999
1.9 * Silicon Graphics Computer Systems, Inc.
1.10 *
1.11 - * Copyright (c) 1999
1.12 + * Copyright (c) 1999
1.13 * Boris Fomitchev
1.14 *
1.15 * This material is provided "as is", with absolutely no warranty expressed
1.16 * or implied. Any use is at your own risk.
1.17 *
1.18 - * Permission to use or copy this software for any purpose is hereby granted
1.19 + * Permission to use or copy this software for any purpose is hereby granted
1.20 * without fee, provided the above notices are retained on all copies.
1.21 * Permission to modify the code and to distribute modified code is granted,
1.22 * provided the above notices are retained, and a notice that the code was
1.23 * modified is included with the above copyright notice.
1.24 *
1.25 - */
1.26 + */
1.27 #ifndef _STLP_IOS_C
1.28 #define _STLP_IOS_C
1.29
1.30 @@ -23,8 +24,6 @@
1.31 # include <stl/_ios.h>
1.32 #endif
1.33
1.34 -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
1.35 -
1.36 #ifndef _STLP_INTERNAL_STREAMBUF
1.37 # include <stl/_streambuf.h>
1.38 #endif
1.39 @@ -42,15 +41,13 @@
1.40 basic_ios<_CharT, _Traits>
1.41 ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
1.42 : ios_base(),
1.43 - _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
1.44 -{
1.45 - init(__streambuf);
1.46 + _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) {
1.47 + basic_ios<_CharT, _Traits>::init(__streambuf);
1.48 }
1.49
1.50 template <class _CharT, class _Traits>
1.51 basic_streambuf<_CharT, _Traits>*
1.52 -basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf)
1.53 -{
1.54 +basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) {
1.55 basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
1.56 _M_streambuf = __buf;
1.57 this->clear();
1.58 @@ -59,38 +56,42 @@
1.59
1.60 template <class _CharT, class _Traits>
1.61 basic_ios<_CharT, _Traits>&
1.62 -basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x)
1.63 -{
1.64 +basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) {
1.65 _M_invoke_callbacks(erase_event);
1.66 _M_copy_state(__x); // Inherited from ios_base.
1.67 _M_fill = __x._M_fill;
1.68 _M_tied_ostream = __x._M_tied_ostream;
1.69 _M_invoke_callbacks(copyfmt_event);
1.70 - // this->_M_set_exception_mask(__x.exceptions()); //Exceptions should copy not simply set. should throw exception if mask&state ==1 ,while copying exception.
1.71 - this->exceptions(__x.exceptions());
1.72 + this->_M_set_exception_mask(__x.exceptions());
1.73 return *this;
1.74 }
1.75 -//#ifndef __SYMBIAN32__ // Moved to src
1.76 +#if defined(__SYMBIAN32__WSD__) || defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
1.77 +#define id GetFacetLocaleId()
1.78 +#endif
1.79 +
1.80 template <class _CharT, class _Traits>
1.81 -locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
1.82 -{
1.83 +locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
1.84 locale __tmp = ios_base::imbue(__loc);
1.85 + _STLP_TRY {
1.86 + if (_M_streambuf)
1.87 + _M_streambuf->pubimbue(__loc);
1.88
1.89 - if (_M_streambuf)
1.90 - _M_streambuf->pubimbue(__loc);
1.91 -
1.92 - // no throwing here
1.93 -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.94 - this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::GetFacetLocaleId()) ;
1.95 - this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::GetFacetLocaleId()) ;
1.96 -#else
1.97 - this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id) ;
1.98 - this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id) ;
1.99 -#endif //__LIBSTD_CPP_SYMBIAN32_WSD__
1.100 - this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping() ;
1.101 + // no throwing here
1.102 + this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id);
1.103 + this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id);
1.104 + this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping();
1.105 + }
1.106 + _STLP_CATCH_ALL {
1.107 + __tmp = ios_base::imbue(__tmp);
1.108 + _M_handle_exception(ios_base::failbit);
1.109 + }
1.110 return __tmp;
1.111 }
1.112 -//#endif // __SYMBIAN32__
1.113 +#if defined(__SYMBIAN32__WSD__) || defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
1.114 +#undef id
1.115 +#endif
1.116 +
1.117 +
1.118 // Protected constructor and initialization functions. The default
1.119 // constructor creates an uninitialized basic_ios, and init() initializes
1.120 // all of the members to the values in Table 89 of the C++ standard.
1.121 @@ -109,7 +110,17 @@
1.122 this->imbue(locale());
1.123 this->tie(0);
1.124 this->_M_set_exception_mask(ios_base::goodbit);
1.125 - this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
1.126 + /*
1.127 + this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
1.128 +
1.129 + The ternary expression above, throws an undefined reference link error (for goodbit and badbit)
1.130 + when compiled with GCCE 4.3.2. Replacing ternary statement with an if-else block fixes this.
1.131 + */
1.132 + if(__sb != 0) {
1.133 + this->_M_clear_nothrow(ios_base::goodbit);
1.134 + } else {
1.135 + this->_M_clear_nothrow(ios_base::badbit);
1.136 + }
1.137 ios_base::flags(ios_base::skipws | ios_base::dec);
1.138 ios_base::width(0);
1.139 ios_base::precision(6);
1.140 @@ -129,6 +140,8 @@
1.141
1.142 _STLP_END_NAMESPACE
1.143
1.144 -#endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */
1.145 +#endif /* _STLP_IOS_C */
1.146
1.147 -#endif /* _STLP_IOS_C */
1.148 +// Local Variables:
1.149 +// mode:C++
1.150 +// End: