ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

complex_io.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 
00019 #include "stlport_prefix.h"
00020 
00021 #include <complex>
00022 #include <istream>
00023 
00024 _STLP_BEGIN_NAMESPACE
00025 
00026 // Specializations for narrow characters; lets us avoid the nuisance of
00027 // widening.
00028 _STLP_OPERATOR_SPEC
00029 basic_ostream<char, char_traits<char> >& _STLP_CALL
00030 operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<float>& __z)
00031 { return __os << '(' << (double)__z.real() << ',' << (double)__z.imag() << ')'; }
00032 
00033 _STLP_OPERATOR_SPEC
00034 basic_ostream<char, char_traits<char> >& _STLP_CALL
00035 operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<double>& __z)
00036 { return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
00037 
00038 #ifndef _STLP_NO_LONG_DOUBLE
00039 _STLP_OPERATOR_SPEC
00040 basic_ostream<char, char_traits<char> >& _STLP_CALL
00041 operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<long double>& __z)
00042 { return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
00043 #endif
00044 
00045 // Specialization for narrow characters; lets us avoid widen.
00046 _STLP_OPERATOR_SPEC
00047 basic_istream<char, char_traits<char> >& _STLP_CALL
00048 operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z) {
00049   float  __re = 0;
00050   float  __im = 0;
00051 
00052   char __c;
00053 
00054   __is >> __c;
00055   if (__c == '(') {
00056     __is >> __re >> __c;
00057     if (__c == ',')
00058       __is >> __im >> __c;
00059     if (__c != ')')
00060       __is.setstate(ios_base::failbit);
00061   }
00062   else {
00063     __is.putback(__c);
00064     __is >> __re;
00065   }
00066 
00067   if (__is)
00068     __z = complex<float>(__re, __im);
00069   return __is;
00070 }
00071 
00072 _STLP_OPERATOR_SPEC
00073 basic_istream<char, char_traits<char> >& _STLP_CALL
00074 operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z) {
00075   double  __re = 0;
00076   double  __im = 0;
00077 
00078   char __c;
00079 
00080   __is >> __c;
00081   if (__c == '(') {
00082     __is >> __re >> __c;
00083     if (__c == ',')
00084       __is >> __im >> __c;
00085     if (__c != ')')
00086       __is.setstate(ios_base::failbit);
00087   }
00088   else {
00089     __is.putback(__c);
00090     __is >> __re;
00091   }
00092 
00093   if (__is)
00094     __z = complex<double>(__re, __im);
00095   return __is;
00096 }
00097 
00098 #ifndef _STLP_NO_LONG_DOUBLE
00099 _STLP_OPERATOR_SPEC
00100 basic_istream<char, char_traits<char> >& _STLP_CALL
00101 operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z) {
00102   long double  __re = 0;
00103   long double  __im = 0;
00104 
00105   char __c;
00106 
00107   __is >> __c;
00108   if (__c == '(') {
00109     __is >> __re >> __c;
00110     if (__c == ',')
00111       __is >> __im >> __c;
00112     if (__c != ')')
00113       __is.setstate(ios_base::failbit);
00114   }
00115   else {
00116     __is.putback(__c);
00117     __is >> __re;
00118   }
00119 
00120   if (__is)
00121     __z = complex<long double>(__re, __im);
00122   return __is;
00123 }
00124 #endif
00125 
00126 // Force instantiation of complex I/O functions
00127 #if !(defined (_STLP_NO_FORCE_INSTANTIATE) || defined (_STLP_NO_WCHAR_T))
00128 
00129 _STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >&  _STLP_CALL
00130 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
00131 
00132 _STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >&  _STLP_CALL
00133 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
00134 
00135 #ifndef _STLP_NO_LONG_DOUBLE
00136 _STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >&  _STLP_CALL
00137 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
00138 
00139 _STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >&  _STLP_CALL
00140 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
00141 #endif
00142 
00143 _STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >&  _STLP_CALL
00144 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
00145 
00146 _STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >&  _STLP_CALL
00147 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
00148 
00149 #endif /* _STLP_NO_WCHAR_T */
00150 
00151 _STLP_END_NAMESPACE
00152 
00153 
00154 // Local Variables:
00155 // mode:C++
00156 // End:
00157 

Generated on Sun May 27 2012 04:35:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.