epoc32/include/stdapis/stlport/stl/_ios.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_ios.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/_ios.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,204 @@
     1.4 -_ios.h
     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_INTERNAL_IOS_H
    1.24 +#define _STLP_INTERNAL_IOS_H
    1.25 +
    1.26 +
    1.27 +#ifndef _STLP_IOS_BASE_H
    1.28 +# include <stl/_ios_base.h>
    1.29 +#endif
    1.30 +
    1.31 +#ifndef _STLP_INTERNAL_CTYPE_H
    1.32 +# include <stl/_ctype.h>
    1.33 +#endif
    1.34 +#ifndef _STLP_INTERNAL_NUMPUNCT_H
    1.35 +# include <stl/_numpunct.h>
    1.36 +#endif
    1.37 +
    1.38 +_STLP_BEGIN_NAMESPACE
    1.39 +
    1.40 +// ----------------------------------------------------------------------
    1.41 +
    1.42 +// Class basic_ios, a subclass of ios_base.  The only important difference
    1.43 +// between the two is that basic_ios is a class template, parameterized
    1.44 +// by the character type.  ios_base exists to factor out all of the
    1.45 +// common properties that don't depend on the character type.
    1.46 +
    1.47 +// The second template parameter, _Traits, defaults to char_traits<_CharT>.
    1.48 +// The default is declared in header <iosfwd>, and it isn't declared here
    1.49 +// because C++ language rules do not allow it to be declared twice.
    1.50 +
    1.51 +template <class _CharT, class _Traits>
    1.52 +#ifdef __SYMBIAN32__
    1.53 +class basic_ios : public ios_base {
    1.54 +#else
    1.55 +class basic_ios : public ios_base {
    1.56 +#endif
    1.57 +  friend class ios_base;
    1.58 +public:                         // Synonyms for types.
    1.59 +  typedef _CharT                     char_type;
    1.60 +  typedef typename _Traits::int_type int_type;
    1.61 +  typedef typename _Traits::pos_type pos_type;
    1.62 +  typedef typename _Traits::off_type off_type;
    1.63 +  typedef _Traits                    traits_type;
    1.64 +
    1.65 +public:                         // Constructor, destructor.
    1.66 +  explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
    1.67 +  virtual ~basic_ios() {}
    1.68 +
    1.69 +public:                         // Members from clause 27.4.4.2
    1.70 +  basic_ostream<_CharT, _Traits>* tie() const {
    1.71 +    return _M_tied_ostream;
    1.72 +  }
    1.73 +  basic_ostream<_CharT, _Traits>*
    1.74 +  tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
    1.75 +    basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
    1.76 +    _M_tied_ostream = __new_tied_ostream;
    1.77 +    return __tmp;
    1.78 +  }
    1.79 +
    1.80 +  basic_streambuf<_CharT, _Traits>* rdbuf() const
    1.81 +    { return _M_streambuf; }
    1.82 +
    1.83 +  basic_streambuf<_CharT, _Traits>*
    1.84 +  rdbuf(basic_streambuf<char_type, traits_type>*);
    1.85 +
    1.86 +  // Copies __x's state to *this.
    1.87 +  basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
    1.88 +
    1.89 +  char_type fill() const { return _M_fill; }
    1.90 +  char_type fill(char_type __fill) {
    1.91 +    char_type __tmp(_M_fill);
    1.92 +    _M_fill = __fill;
    1.93 +    return __tmp;
    1.94 +  }
    1.95 +
    1.96 +public:                         // Members from 27.4.4.3.  These four functions
    1.97 +                                // can almost be defined in ios_base.
    1.98 +
    1.99 +  void clear(iostate __state = goodbit) {
   1.100 +    _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
   1.101 +    _M_check_exception_mask();
   1.102 +  }
   1.103 +  void setstate(iostate __state) { this->clear(rdstate() | __state); }
   1.104 +
   1.105 +  iostate exceptions() const { return this->_M_get_exception_mask(); }
   1.106 +  void exceptions(iostate __mask) {
   1.107 +    this->_M_set_exception_mask(__mask);
   1.108 +    this->clear(this->rdstate());
   1.109 +  }
   1.110 +
   1.111 +public:                         // Locale-related member functions.
   1.112 +  locale imbue(const locale&);
   1.113 +
   1.114 +  inline char narrow(_CharT, char) const ;
   1.115 +  inline _CharT widen(char) const; 
   1.116 +
   1.117 +  // Helper function that makes testing for EOF more convenient.
   1.118 +  static bool _STLP_CALL _S_eof(int_type __c) {
   1.119 +    const int_type __eof = _Traits::eof();
   1.120 +    return _Traits::eq_int_type(__c, __eof);
   1.121 +  }
   1.122 +
   1.123 +protected:
   1.124 +  basic_ios();
   1.125 +
   1.126 +  void init(basic_streambuf<_CharT, _Traits>* __streambuf);
   1.127 +
   1.128 +public:
   1.129 +  
   1.130 +  // Helper function used in istream and ostream.  It is called only from
   1.131 +  // a catch clause.
   1.132 +  void _M_handle_exception(ios_base::iostate __flag);
   1.133 +  
   1.134 +private:                        // Data members
   1.135 +  char_type _M_fill;            // The fill character, used for padding.
   1.136 +
   1.137 +  basic_streambuf<_CharT, _Traits>* _M_streambuf;
   1.138 +  basic_ostream<_CharT, _Traits>*   _M_tied_ostream;
   1.139 +
   1.140 +};
   1.141 +
   1.142 +
   1.143 +template <class _CharT, class _Traits>
   1.144 +inline char 
   1.145 +basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
   1.146 +{ return ((const ctype<_CharT>*)this->_M_ctype_facet())->narrow(__c, __default); }
   1.147 +
   1.148 +template <class _CharT, class _Traits>
   1.149 +inline _CharT 
   1.150 +basic_ios<_CharT, _Traits>::widen(char __c) const
   1.151 +{ 
   1.152 +  return ((const ctype<_CharT>*)this->_M_ctype_facet())->widen(__c); }
   1.153 +
   1.154 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.155 +_STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
   1.156 +#  if ! defined (_STLP_NO_WCHAR_T)
   1.157 +_STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
   1.158 +#  endif
   1.159 +# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.160 +
   1.161 +# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
   1.162 +_STLP_TEMPLATE_NULL
   1.163 +inline char
   1.164 +basic_ios<char, char_traits<char> >::narrow(char __c, char) const
   1.165 +{
   1.166 +  return __c;
   1.167 +}
   1.168 +
   1.169 +_STLP_TEMPLATE_NULL
   1.170 +inline char
   1.171 +basic_ios<char, char_traits<char> >::widen(char __c) const
   1.172 +{
   1.173 +  return __c;
   1.174 +}
   1.175 +# endif /* _STLP_NO_METHOD_SPECIALIZATION */
   1.176 +
   1.177 +
   1.178 +_STLP_END_NAMESPACE
   1.179 +
   1.180 +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
   1.181 +#  include <stl/_ios.c>
   1.182 +# endif
   1.183 +
   1.184 +// The following is needed to ensure that the inlined _Stl_loc_init functions
   1.185 +// that ios_base::_Loc_init::_Loc_init() calls are found eventually.
   1.186 +// Otherwise, undefined externs may be caused.
   1.187 +
   1.188 +#if defined(__BORLANDC__) && defined(_RTLDLL)
   1.189 +# ifndef _STLP_INTERNAL_NUM_PUT_H
   1.190 +#  include <stl/_num_put.h>
   1.191 +# endif
   1.192 +# ifndef _STLP_INTERNAL_NUM_GET_H
   1.193 +#   include <stl/_num_get.h>
   1.194 +# endif
   1.195 +# ifndef _STLP_INTERNAL_MONETARY_H
   1.196 +#  include <stl/_monetary.h>
   1.197 +# endif
   1.198 +# ifndef _STLP_INTERNAL_TIME_FACETS_H
   1.199 +#  include <stl/_time_facets.h>
   1.200 +# endif
   1.201 +#endif
   1.202 +
   1.203 +#endif /* _STLP_IOS */
   1.204 +
   1.205 +// Local Variables:
   1.206 +// mode:C++
   1.207 +// End:
   1.208 +