1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_ios.c Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,134 @@
1.4 +/*
1.5 + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.6 + * Copyright (c) 1999
1.7 + * Silicon Graphics Computer Systems, Inc.
1.8 + *
1.9 + * Copyright (c) 1999
1.10 + * Boris Fomitchev
1.11 + *
1.12 + * This material is provided "as is", with absolutely no warranty expressed
1.13 + * or implied. Any use is at your own risk.
1.14 + *
1.15 + * Permission to use or copy this software for any purpose is hereby granted
1.16 + * without fee, provided the above notices are retained on all copies.
1.17 + * Permission to modify the code and to distribute modified code is granted,
1.18 + * provided the above notices are retained, and a notice that the code was
1.19 + * modified is included with the above copyright notice.
1.20 + *
1.21 + */
1.22 +#ifndef _STLP_IOS_C
1.23 +#define _STLP_IOS_C
1.24 +
1.25 +#ifndef _STLP_INTERNAL_IOS_H
1.26 +# include <stl/_ios.h>
1.27 +#endif
1.28 +
1.29 +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
1.30 +
1.31 +#ifndef _STLP_INTERNAL_STREAMBUF
1.32 +# include <stl/_streambuf.h>
1.33 +#endif
1.34 +
1.35 +#ifndef _STLP_INTERNAL_NUMPUNCT_H
1.36 +# include <stl/_numpunct.h>
1.37 +#endif
1.38 +
1.39 +_STLP_BEGIN_NAMESPACE
1.40 +
1.41 +// basic_ios<>'s non-inline member functions
1.42 +
1.43 +// Public constructor, taking a streambuf.
1.44 +template <class _CharT, class _Traits>
1.45 +basic_ios<_CharT, _Traits>
1.46 + ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
1.47 + : ios_base(),
1.48 + _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
1.49 +{
1.50 + init(__streambuf);
1.51 +}
1.52 +
1.53 +template <class _CharT, class _Traits>
1.54 +basic_streambuf<_CharT, _Traits>*
1.55 +basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf)
1.56 +{
1.57 + basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
1.58 + _M_streambuf = __buf;
1.59 + this->clear();
1.60 + return __tmp;
1.61 +}
1.62 +
1.63 +template <class _CharT, class _Traits>
1.64 +basic_ios<_CharT, _Traits>&
1.65 +basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x)
1.66 +{
1.67 + _M_invoke_callbacks(erase_event);
1.68 + _M_copy_state(__x); // Inherited from ios_base.
1.69 + _M_fill = __x._M_fill;
1.70 + _M_tied_ostream = __x._M_tied_ostream;
1.71 + _M_invoke_callbacks(copyfmt_event);
1.72 + // this->_M_set_exception_mask(__x.exceptions()); //Exceptions should copy not simply set. should throw exception if mask&state ==1 ,while copying exception.
1.73 + this->exceptions(__x.exceptions());
1.74 + return *this;
1.75 +}
1.76 +//#ifndef __SYMBIAN32__ // Moved to src
1.77 +template <class _CharT, class _Traits>
1.78 +locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
1.79 +{
1.80 + locale __tmp = ios_base::imbue(__loc);
1.81 +
1.82 + if (_M_streambuf)
1.83 + _M_streambuf->pubimbue(__loc);
1.84 +
1.85 + // no throwing here
1.86 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.87 + this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::GetFacetLocaleId()) ;
1.88 + this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::GetFacetLocaleId()) ;
1.89 +#else
1.90 + this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id) ;
1.91 + this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id) ;
1.92 +#endif //__LIBSTD_CPP_SYMBIAN32_WSD__
1.93 + this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping() ;
1.94 + return __tmp;
1.95 +}
1.96 +//#endif // __SYMBIAN32__
1.97 +// Protected constructor and initialization functions. The default
1.98 +// constructor creates an uninitialized basic_ios, and init() initializes
1.99 +// all of the members to the values in Table 89 of the C++ standard.
1.100 +
1.101 +template <class _CharT, class _Traits>
1.102 +basic_ios<_CharT, _Traits>::basic_ios()
1.103 + : ios_base(),
1.104 + _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
1.105 +{}
1.106 +
1.107 +template <class _CharT, class _Traits>
1.108 +void
1.109 +basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
1.110 +{
1.111 + this->rdbuf(__sb);
1.112 + this->imbue(locale());
1.113 + this->tie(0);
1.114 + this->_M_set_exception_mask(ios_base::goodbit);
1.115 + this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
1.116 + ios_base::flags(ios_base::skipws | ios_base::dec);
1.117 + ios_base::width(0);
1.118 + ios_base::precision(6);
1.119 + this->fill(widen(' '));
1.120 + // We don't need to worry about any of the three arrays: they are
1.121 + // initialized correctly in ios_base's constructor.
1.122 +}
1.123 +
1.124 +// This is never called except from within a catch clause.
1.125 +template <class _CharT, class _Traits>
1.126 +void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag)
1.127 +{
1.128 + this->_M_setstate_nothrow(__flag);
1.129 + if (this->_M_get_exception_mask() & __flag)
1.130 + _STLP_RETHROW;
1.131 +}
1.132 +
1.133 +_STLP_END_NAMESPACE
1.134 +
1.135 +#endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */
1.136 +
1.137 +#endif /* _STLP_IOS_C */