ReactOS 0.4.15-dev-8116-gf69e256
_complex.c File Reference
#include <stl/_complex.h>
#include <stl/_istream.h>
#include <stl/_sstream.h>
#include <stl/_string_io.h>
Include dependency graph for _complex.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _STLP_COMPLEX_C
 

Functions

template<class _Tp , class _CharT , class _Traits >
basic_ostream< _CharT, _Traits > &_STLP_CALL operator<< (basic_ostream< _CharT, _Traits > &__os, const complex< _Tp > &__z)
 
template<class _Tp , class _CharT , class _Traits >
basic_istream< _CharT, _Traits > &_STLP_CALL operator>> (basic_istream< _CharT, _Traits > &__is, complex< _Tp > &__z)
 

Macro Definition Documentation

◆ _STLP_COMPLEX_C

#define _STLP_COMPLEX_C

Definition at line 19 of file _complex.c.

Function Documentation

◆ operator<<()

template<class _Tp , class _CharT , class _Traits >
basic_ostream< _CharT, _Traits > &_STLP_CALL operator<< ( basic_ostream< _CharT, _Traits > &  __os,
const complex< _Tp > &  __z 
)

Definition at line 91 of file _complex.c.

92 {
94 __tmp.flags(__os.flags());
95 __tmp.imbue(__os.getloc());
96 __tmp.precision(__os.precision());
97 __tmp << '(' << __z.real() << ',' << __z.imag() << ')';
98 return __os << __tmp.str();
99}
locale imbue(const locale &)
Definition: _ios.c:69
_String str() const
Definition: _sstream.h:184
fmtflags flags() const
Definition: _ios_base.h:107
locale getloc() const
Definition: _ios_base.h:143
streamsize precision() const
Definition: _ios_base.h:127
value_type real() const
Definition: _complex.h:69
value_type imag() const
Definition: _complex.h:70

◆ operator>>()

template<class _Tp , class _CharT , class _Traits >
basic_istream< _CharT, _Traits > &_STLP_CALL operator>> ( basic_istream< _CharT, _Traits > &  __is,
complex< _Tp > &  __z 
)

Definition at line 107 of file _complex.c.

107 {
108 _Tp __re = 0;
109 _Tp __im = 0;
110
111 const ctype<_CharT>& __c_type = *__is._M_ctype_facet();
112
113 const char __punct[4] = "(,)";
114 _CharT __wpunct[3];
115 __c_type.widen(__punct, __punct + 3, __wpunct);
116
117 _CharT __c;
118
119 __is >> __c;
120 if (_Traits::eq(__c, __wpunct[0])) { // Left paren
121 __is >> __re >> __c;
122 if (_Traits::eq(__c, __wpunct[1])) // Comma
123 __is >> __im >> __c;
124 if (!_Traits::eq(__c, __wpunct[2])) // Right paren
125 __is.setstate(ios_base::failbit);
126 }
127 else {
128 __is.putback(__c);
129 __is >> __re;
130 }
131
132 if (__is)
133 __z = complex<_Tp>(__re, __im);
134 return __is;
135}
const ctype< char_type > * _M_ctype_facet() const
Definition: _ios.h:121
void setstate(iostate __state)
Definition: _ios.h:95
_Self & putback(char_type __c)
Definition: _istream.c:422
Definition: _ctype.h:58
#define __c
Definition: schilyio.h:209