epoc32/include/tools/stlport/stl/_ios.h
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.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,178 @@
     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_INTERNAL_IOS_H
    1.22 +#define _STLP_INTERNAL_IOS_H
    1.23 +
    1.24 +
    1.25 +#ifndef _STLP_IOS_BASE_H
    1.26 +# include <stl/_ios_base.h>
    1.27 +#endif
    1.28 +
    1.29 +#ifndef _STLP_INTERNAL_CTYPE_H
    1.30 +# include <stl/_ctype.h>
    1.31 +#endif
    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 +// ----------------------------------------------------------------------
    1.39 +
    1.40 +// Class basic_ios, a subclass of ios_base.  The only important difference
    1.41 +// between the two is that basic_ios is a class template, parameterized
    1.42 +// by the character type.  ios_base exists to factor out all of the
    1.43 +// common properties that don't depend on the character type.
    1.44 +
    1.45 +// The second template parameter, _Traits, defaults to char_traits<_CharT>.
    1.46 +// The default is declared in header <iosfwd>, and it isn't declared here
    1.47 +// because C++ language rules do not allow it to be declared twice.
    1.48 +
    1.49 +template <class _CharT, class _Traits>
    1.50 +class basic_ios : public ios_base {
    1.51 +  friend class ios_base;
    1.52 +public:                         // Synonyms for types.
    1.53 +  typedef _CharT                     char_type;
    1.54 +  typedef typename _Traits::int_type int_type;
    1.55 +  typedef typename _Traits::pos_type pos_type;
    1.56 +  typedef typename _Traits::off_type off_type;
    1.57 +  typedef _Traits                    traits_type;
    1.58 +
    1.59 +public:                         // Constructor, destructor.
    1.60 +  explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
    1.61 +  virtual ~basic_ios() {}
    1.62 +
    1.63 +public:                         // Members from clause 27.4.4.2
    1.64 +  basic_ostream<_CharT, _Traits>* tie() const {
    1.65 +    return _M_tied_ostream;
    1.66 +  }
    1.67 +  basic_ostream<_CharT, _Traits>*
    1.68 +  tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
    1.69 +    basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
    1.70 +    _M_tied_ostream = __new_tied_ostream;
    1.71 +    return __tmp;
    1.72 +  }
    1.73 +
    1.74 +  basic_streambuf<_CharT, _Traits>* rdbuf() const
    1.75 +    { return _M_streambuf; }
    1.76 +
    1.77 +  basic_streambuf<_CharT, _Traits>*
    1.78 +  rdbuf(basic_streambuf<char_type, traits_type>*);
    1.79 +
    1.80 +  // Copies __x's state to *this.
    1.81 +  basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
    1.82 +
    1.83 +  char_type fill() const { return _M_fill; }
    1.84 +  char_type fill(char_type __fill) {
    1.85 +    char_type __tmp(_M_fill);
    1.86 +    _M_fill = __fill;
    1.87 +    return __tmp;
    1.88 +  }
    1.89 +
    1.90 +public:                         // Members from 27.4.4.3.  These four functions
    1.91 +                                // can almost be defined in ios_base.
    1.92 +
    1.93 +  void clear(iostate __state = goodbit) {
    1.94 +    _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
    1.95 +    _M_check_exception_mask();
    1.96 +  }
    1.97 +  void setstate(iostate __state) { this->clear(rdstate() | __state); }
    1.98 +
    1.99 +  iostate exceptions() const { return this->_M_get_exception_mask(); }
   1.100 +  void exceptions(iostate __mask) {
   1.101 +    this->_M_set_exception_mask(__mask);
   1.102 +    this->clear(this->rdstate());
   1.103 +  }
   1.104 +
   1.105 +public:                         // Locale-related member functions.
   1.106 +  locale imbue(const locale&);
   1.107 +
   1.108 +  inline char narrow(_CharT, char) const ;
   1.109 +  inline _CharT widen(char) const;
   1.110 +
   1.111 +  // Helper function that makes testing for EOF more convenient.
   1.112 +  static bool _STLP_CALL _S_eof(int_type __c) {
   1.113 +    const int_type __eof = _Traits::eof();
   1.114 +    return _Traits::eq_int_type(__c, __eof);
   1.115 +  }
   1.116 +
   1.117 +protected:
   1.118 +  basic_ios();
   1.119 +
   1.120 +  void init(basic_streambuf<_CharT, _Traits>* __streambuf);
   1.121 +
   1.122 +public:
   1.123 +
   1.124 +  // Helper function used in istream and ostream.  It is called only from
   1.125 +  // a catch clause.
   1.126 +  void _M_handle_exception(ios_base::iostate __flag);
   1.127 +
   1.128 +private:                        // Data members
   1.129 +  char_type _M_fill;            // The fill character, used for padding.
   1.130 +
   1.131 +  basic_streambuf<_CharT, _Traits>* _M_streambuf;
   1.132 +  basic_ostream<_CharT, _Traits>*   _M_tied_ostream;
   1.133 +
   1.134 +};
   1.135 +
   1.136 +
   1.137 +template <class _CharT, class _Traits>
   1.138 +inline char
   1.139 +basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
   1.140 +{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->narrow(__c, __default); }
   1.141 +
   1.142 +template <class _CharT, class _Traits>
   1.143 +inline _CharT
   1.144 +basic_ios<_CharT, _Traits>::widen(char __c) const
   1.145 +{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->widen(__c); }
   1.146 +
   1.147 +# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
   1.148 +_STLP_TEMPLATE_NULL
   1.149 +inline char
   1.150 +basic_ios<char, char_traits<char> >::narrow(char __c, char) const
   1.151 +{
   1.152 +  return __c;
   1.153 +}
   1.154 +
   1.155 +_STLP_TEMPLATE_NULL
   1.156 +inline char
   1.157 +basic_ios<char, char_traits<char> >::widen(char __c) const
   1.158 +{
   1.159 +  return __c;
   1.160 +}
   1.161 +# endif /* _STLP_NO_METHOD_SPECIALIZATION */
   1.162 +
   1.163 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.164 +_STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
   1.165 +#  if ! defined (_STLP_NO_WCHAR_T)
   1.166 +_STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
   1.167 +#  endif
   1.168 +# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.169 +
   1.170 +_STLP_END_NAMESPACE
   1.171 +
   1.172 +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
   1.173 +#  include <stl/_ios.c>
   1.174 +#endif
   1.175 +
   1.176 +#endif /* _STLP_IOS */
   1.177 +
   1.178 +// Local Variables:
   1.179 +// mode:C++
   1.180 +// End:
   1.181 +