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