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