diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_complex.c --- a/epoc32/include/stdapis/stlportv5/stl/_complex.c Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_complex.c Wed Mar 31 12:33:34 2010 +0100 @@ -2,30 +2,38 @@ * Copyright (c) 1999 * Silicon Graphics Computer Systems, Inc. * - * Copyright (c) 1999 + * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * - * Permission to use or copy this software for any purpose is hereby granted + * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * - */ + */ #ifndef _STLP_COMPLEX_C #define _STLP_COMPLEX_C -# ifndef _STLP_internal_complex_h +#ifndef _STLP_INTERNAL_COMPLEX # include -# endif +#endif -#include +#if !defined (_STLP_USE_NO_IOSTREAMS) +# ifndef _STLP_INTERNAL_ISTREAM +# include +# endif -#ifdef _STLP_USE_NEW_IOSTREAMS -# include +# ifndef _STLP_INTERNAL_SSTREAM +# include +# endif + +# ifndef _STLP_STRING_IO_H +# include +# endif #endif _STLP_BEGIN_NAMESPACE @@ -75,15 +83,13 @@ } // I/O. +#if !defined (_STLP_USE_NO_IOSTREAMS) -#ifdef _STLP_USE_NEW_IOSTREAMS - -// Complex output, in the form (re,im). We use a two-step process -// involving stringstream so that we get the padding right. +// Complex output, in the form (re,im). We use a two-step process +// involving stringstream so that we get the padding right. template basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) -{ +operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) { basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp; __tmp.flags(__os.flags()); __tmp.imbue(__os.getloc()); @@ -98,17 +104,16 @@ template basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) -{ +operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) { _Tp __re = 0; _Tp __im = 0; // typedef ctype<_CharT> _Ctype; // locale __loc = __is.getloc(); //const _Ctype& __c_type = use_facet<_Ctype>(__loc); - const ctype<_CharT>& __c_type = *(const ctype<_CharT>*)__is._M_ctype_facet(); + const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __is._M_ctype_facet()); - char __punct[4] = "(,)"; + const char __punct[4] = "(,)"; _CharT __wpunct[3]; __c_type.widen(__punct, __punct + 3, __wpunct); @@ -132,38 +137,12 @@ return __is; } - -#else /* _STLP_USE_NEW_IOSTREAMS */ - -template -ostream& _STLP_CALL operator<<(ostream& s, const complex<_Tp>& __z) -{ - return s << "( " << __z._M_re <<", " << __z._M_im <<")"; -} - -template -istream& _STLP_CALL operator>>(istream& s, complex<_Tp>& a) -{ - _Tp re = 0, im = 0; - char c = 0; - - s >> c; - if (c == '(') { - s >> re >> c; - if (c == ',') s >> im >> c; - if (c != ')') s.clear(ios::badbit); - } - else { - s.putback(c); - s >> re; - } - - if (s) a = complex<_Tp>(re, im); - return s; -} - -#endif /* _STLP_USE_NEW_IOSTREAMS */ +#endif /* _STLP_USE_NO_IOSTREAMS */ _STLP_END_NAMESPACE #endif /* _STLP_COMPLEX_C */ + +// Local Variables: +// mode:C++ +// End: