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