1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_complex.c Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_complex.c Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -2,30 +2,38 @@
1.4 * Copyright (c) 1999
1.5 * Silicon Graphics Computer Systems, Inc.
1.6 *
1.7 - * Copyright (c) 1999
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 + * 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 + */
1.23 #ifndef _STLP_COMPLEX_C
1.24 #define _STLP_COMPLEX_C
1.25
1.26 -# ifndef _STLP_internal_complex_h
1.27 +#ifndef _STLP_INTERNAL_COMPLEX
1.28 # include <stl/_complex.h>
1.29 -# endif
1.30 +#endif
1.31
1.32 -#include <istream>
1.33 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.34 +# ifndef _STLP_INTERNAL_ISTREAM
1.35 +# include <stl/_istream.h>
1.36 +# endif
1.37
1.38 -#ifdef _STLP_USE_NEW_IOSTREAMS
1.39 -# include <sstream>
1.40 +# ifndef _STLP_INTERNAL_SSTREAM
1.41 +# include <stl/_sstream.h>
1.42 +# endif
1.43 +
1.44 +# ifndef _STLP_STRING_IO_H
1.45 +# include <stl/_string_io.h>
1.46 +# endif
1.47 #endif
1.48
1.49 _STLP_BEGIN_NAMESPACE
1.50 @@ -75,15 +83,13 @@
1.51 }
1.52
1.53 // I/O.
1.54 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.55
1.56 -#ifdef _STLP_USE_NEW_IOSTREAMS
1.57 -
1.58 -// Complex output, in the form (re,im). We use a two-step process
1.59 -// involving stringstream so that we get the padding right.
1.60 +// Complex output, in the form (re,im). We use a two-step process
1.61 +// involving stringstream so that we get the padding right.
1.62 template <class _Tp, class _CharT, class _Traits>
1.63 basic_ostream<_CharT, _Traits>& _STLP_CALL
1.64 -operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z)
1.65 -{
1.66 +operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) {
1.67 basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp;
1.68 __tmp.flags(__os.flags());
1.69 __tmp.imbue(__os.getloc());
1.70 @@ -98,17 +104,16 @@
1.71
1.72 template <class _Tp, class _CharT, class _Traits>
1.73 basic_istream<_CharT, _Traits>& _STLP_CALL
1.74 -operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z)
1.75 -{
1.76 +operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) {
1.77 _Tp __re = 0;
1.78 _Tp __im = 0;
1.79
1.80 // typedef ctype<_CharT> _Ctype;
1.81 // locale __loc = __is.getloc();
1.82 //const _Ctype& __c_type = use_facet<_Ctype>(__loc);
1.83 - const ctype<_CharT>& __c_type = *(const ctype<_CharT>*)__is._M_ctype_facet();
1.84 + const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __is._M_ctype_facet());
1.85
1.86 - char __punct[4] = "(,)";
1.87 + const char __punct[4] = "(,)";
1.88 _CharT __wpunct[3];
1.89 __c_type.widen(__punct, __punct + 3, __wpunct);
1.90
1.91 @@ -132,38 +137,12 @@
1.92 return __is;
1.93 }
1.94
1.95 -
1.96 -#else /* _STLP_USE_NEW_IOSTREAMS */
1.97 -
1.98 -template <class _Tp>
1.99 -ostream& _STLP_CALL operator<<(ostream& s, const complex<_Tp>& __z)
1.100 -{
1.101 - return s << "( " << __z._M_re <<", " << __z._M_im <<")";
1.102 -}
1.103 -
1.104 -template <class _Tp>
1.105 -istream& _STLP_CALL operator>>(istream& s, complex<_Tp>& a)
1.106 -{
1.107 - _Tp re = 0, im = 0;
1.108 - char c = 0;
1.109 -
1.110 - s >> c;
1.111 - if (c == '(') {
1.112 - s >> re >> c;
1.113 - if (c == ',') s >> im >> c;
1.114 - if (c != ')') s.clear(ios::badbit);
1.115 - }
1.116 - else {
1.117 - s.putback(c);
1.118 - s >> re;
1.119 - }
1.120 -
1.121 - if (s) a = complex<_Tp>(re, im);
1.122 - return s;
1.123 -}
1.124 -
1.125 -#endif /* _STLP_USE_NEW_IOSTREAMS */
1.126 +#endif /* _STLP_USE_NO_IOSTREAMS */
1.127
1.128 _STLP_END_NAMESPACE
1.129
1.130 #endif /* _STLP_COMPLEX_C */
1.131 +
1.132 +// Local Variables:
1.133 +// mode:C++
1.134 +// End: