24 #if !defined(SSTREAM_H) 32 #include <streambuf.h> 43 template <
class charT,
class traits>
44 class basic_streambuf:
public streambuf
47 typedef char char_type;
50 typedef streampos pos_type;
51 typedef streamoff off_type;
54 template <
class charT,
class traits>
55 class basic_istream:
public istream
58 typedef char char_type;
61 typedef streampos pos_type;
62 typedef streamoff off_type;
64 template <
class charT,
class traits>
65 class basic_ostream:
public ostream
68 typedef char char_type;
71 typedef streampos pos_type;
72 typedef streamoff off_type;
74 template <
class charT,
class traits>
75 class basic_iostream:
public iostream
78 typedef char char_type;
81 typedef streampos pos_type;
82 typedef streamoff off_type;
85 struct ios_base:
public ios
87 typedef seek_dir seekdir;
93 template <
class _CS_cT,
class _CS_traits,
class _CS_alloc =
string_
char_traits<_CS_cT> >
97 typedef basic_string<_CS_cT, _CS_traits, _CS_alloc>
string_type;
98 typedef typename basic_streambuf<_CS_cT, _CS_traits>::char_type
char_type;
99 typedef typename basic_streambuf<_CS_cT, _CS_traits>::traits_type
traits_type;
100 typedef typename basic_streambuf<_CS_cT, _CS_traits>::int_type
int_type;
101 typedef typename basic_streambuf<_CS_cT, _CS_traits>::pos_type
pos_type;
102 typedef typename basic_streambuf<_CS_cT, _CS_traits>::off_type
off_type;
106 ios_base::openmode = ios_base::in | ios_base::out);
109 basic_string<_CS_cT, _CS_traits, _CS_alloc> str()
const;
110 void str(basic_string<_CS_cT, _CS_traits, _CS_alloc>
const&);
113 int_type underflow();
114 int_type pbackfail(int_type);
115 int_type overflow(int_type);
116 basic_streambuf<_CS_cT, _CS_traits>* setbuf(char_type*, streamsize);
117 pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode);
118 pos_type seekpos(pos_type pos, ios_base::openmode);
132 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
141 _CS_string_type str()
const;
142 void str(_CS_string_type
const&);
150 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
152 public basic_istream<_CS_cT, _CS_Tr>
155 typedef typename basic_istream<_CS_cT, _CS_Tr>::char_type
char_type;
156 typedef typename basic_istream<_CS_cT, _CS_Tr>::int_type
int_type;
157 typedef typename basic_istream<_CS_cT, _CS_Tr>::pos_type
pos_type;
158 typedef typename basic_istream<_CS_cT, _CS_Tr>::off_type
off_type;
159 typedef typename basic_istream<_CS_cT, _CS_Tr>::traits_type
traits_type;
170 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
172 public basic_ostream<_CS_cT, _CS_Tr>
175 typedef typename basic_ostream<_CS_cT, _CS_Tr>::char_type
char_type;
176 typedef typename basic_ostream<_CS_cT, _CS_Tr>::int_type
int_type;
177 typedef typename basic_ostream<_CS_cT, _CS_Tr>::pos_type
pos_type;
178 typedef typename basic_ostream<_CS_cT, _CS_Tr>::off_type
off_type;
189 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
191 public basic_iostream<_CS_cT, _CS_Tr>
197 explicit basic_stringstream(_CS_string_type
const&, ios_base::openmode = ios_base::in|ios_base::out);
209 #if !defined(SSTREAM_CC) 220 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
228 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
230 ios_base::openmode _CS_m):
232 _CS_m_beg(_CS_s.size() > 0?
new _CS_cT[_CS_s.size()]: 0),
233 _CS_m_end(_CS_m_beg + _CS_s.size())
236 if (_CS_m & ios_base::in)
237 setg(_CS_m_beg, _CS_m_beg, _CS_m_end);
238 if (_CS_m & ios_base::out)
239 setp(_CS_m_beg, _CS_m_end);
242 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
248 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
249 basic_string<_CS_cT, _CS_Tr, _CS_Al>
252 if (pbase() == epptr())
253 if (eback() == egptr())
254 return basic_string<_CS_cT, _CS_Tr, _CS_Al>();
256 return basic_string<_CS_cT, _CS_Tr, _CS_Al>(eback(), egptr());
258 return basic_string<_CS_cT, _CS_Tr, _CS_Al>(pbase(), epptr());
261 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
265 _CS_cT* _CS_nv =
new _CS_cT[_CS_s.size()];
278 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
282 return gptr() == egptr()? traits_type::eof()
283 : traits_type::to_int_type(*gptr());
286 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
290 if (eback() != gptr())
292 if (traits_type::eq_int_type(_CS_c, traits_type::eof()))
295 return traits_type::not_eof(_CS_c);
298 if (traits_type::eq(traits_type::to_char_type(_CS_c), gptr()[-1])
302 traits_type::assign(*gptr(), traits_type::to_char_type(_CS_c));
310 return traits_type::eof();
313 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
317 if (traits_type::eq_int_type(_CS_c, traits_type::eof()))
318 return traits_type::not_eof(_CS_c);
328 if (pptr() != epptr())
330 traits_type::assign(*pptr(), traits_type::to_char_type(_CS_c));
335 traits_type::assign(*pptr(), traits_type::to_char_type(_CS_c));
336 setp(pbase(), epptr() + 1);
337 pbump(epptr() - pbase());
339 setg(eback(), gptr(), pptr());
344 _CS_cT* _CS_nv =
new _CS_cT[2 * _CS_size];
349 traits_type::assign(_CS_m_beg[_CS_size], traits_type::to_char_type(_CS_c));
350 setp(_CS_m_beg, _CS_m_beg + _CS_size + 1);
354 setg(pbase(), pbase() + (egptr() - gptr()), pptr());
359 return traits_type::eof();
362 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
363 basic_streambuf<_CS_cT, _CS_Tr>*
370 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
373 ios_base::seekdir _CS_dir,
374 ios_base::openmode _CS_which)
377 _CS_cT* _CS_e =
_CS_m_mode & ios_base::out? epptr(): egptr();
382 if (_CS_off < 0 || (_CS_e -
_CS_m_beg) < _CS_off)
387 if (_CS_off > 0 || (_CS_e -
_CS_m_beg) < -_CS_off)
389 _CS_np = _CS_e + _CS_off;
392 if ((_CS_which & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out)
395 _CS_np = (_CS_which & ios_base::in)? gptr(): pptr();
398 || _CS_e - _CS_np < _CS_off)
404 switch (_CS_which & (ios_base::in | ios_base::out))
408 gbump(_CS_np - gptr());
414 pbump(_CS_np - pptr());
418 case ios_base::in | ios_base::out:
419 if ((
_CS_m_mode & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out))
421 gbump(_CS_np - gptr());
422 pbump(_CS_np - pptr());
434 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
437 ios_base::openmode _CS_which)
439 _CS_cT* _CS_p = (
_CS_m_mode & ios_base::out)? epptr(): egptr();
440 if (_CS_pos < 0 || (_CS_p -
_CS_m_beg) < _CS_pos)
445 switch (_CS_which & (ios_base::in | ios_base::out) &
_CS_m_mode)
448 gbump(_CS_p - gptr());
451 pbump(_CS_p - pptr());
453 case ios_base::in | ios_base::out:
454 gbump(_CS_p - gptr());
455 pbump(_CS_p - pptr());
464 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
469 return traits_type::not_eof(traits_type::eof());
474 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
477 _CS_m_ssbuf(_CS_mode)
481 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
484 ios_base::openmode _CS_mode):
489 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
490 basic_string<_CS_cT, _CS_Tr, _CS_Al>
496 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
506 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
508 ios_base::openmode _CS_mode):
516 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
519 ios_base::openmode _CS_mode):
528 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
530 ios_base::openmode _CS_mode):
536 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
539 ios_base::openmode _CS_mode):
541 _CS_mode | ios_base::out),
550 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
552 ios_base::openmode _CS_mode):
560 template <
class _CS_cT,
class _CS_Tr,
class _CS_Al>
563 ios_base::openmode _CS_mode):
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
basic_ostream< _CS_cT, _CS_Tr >::pos_type pos_type
basic_istringstream(ios_base::openmode=ios_base::in)
basic_istream< _CS_cT, _CS_Tr >::pos_type pos_type
basic_stringstream(ios_base::openmode=ios_base::in|ios_base::out)
basic_istream< _CS_cT, _CS_Tr >::traits_type traits_type
basic_string< _CS_cT, _CS_Tr, _CS_Al > _CS_string_type
basic_istream< _CS_cT, _CS_Tr >::char_type char_type
basic_streambuf< _CS_cT, _CS_traits >::char_type char_type
basic_string< _CS_cT, _CS_Tr, _CS_Al > _CS_string_type
basic_streambuf< _CS_cT, _CS_traits >::int_type int_type
basic_string< _CS_cT, _CS_Tr, _CS_Al > _CS_string_type
basic_stringbuf< _CS_cT, _CS_Tr, _CS_Al > * rdbuf() const
basic_istringstream< char, string_char_traits< char >, alloc > istringstream
basic_stringstream< char, string_char_traits< char >, alloc > stringstream
int_type pbackfail(int_type)
pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode)
basic_stringbuf< char, string_char_traits< char >, alloc > stringbuf
_CS_string_type str() const
basic_stringbuf< _CS_cT, _CS_Tr, _CS_Al > * rdbuf() const
_CS_basic_sstream_base(ios_base::openmode)
basic_streambuf< _CS_cT, _CS_traits >::traits_type traits_type
basic_stringbuf< _CS_cT, _CS_Tr, _CS_Al > _CS_m_ssbuf
basic_ostream< _CS_cT, _CS_Tr >::int_type int_type
basic_string< _CS_cT, _CS_traits, _CS_alloc > string_type
basic_istream< _CS_cT, _CS_Tr >::int_type int_type
basic_istream< _CS_cT, _CS_Tr >::off_type off_type
int_type overflow(int_type)
basic_ostream< _CS_cT, _CS_Tr >::char_type char_type
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
Workspace & init(Workspace &ws)
basic_string< _CS_cT, _CS_traits, _CS_alloc > str() const
basic_string< _CS_cT, _CS_Tr, _CS_Al > _CS_string_type
basic_ostringstream(ios_base::openmode=ios_base::out)
basic_ostream< _CS_cT, _CS_Tr >::off_type off_type
pos_type seekpos(pos_type pos, ios_base::openmode)
basic_streambuf< _CS_cT, _CS_traits > * setbuf(char_type *, streamsize)
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
basic_streambuf< _CS_cT, _CS_traits >::off_type off_type
basic_stringbuf< _CS_cT, _CS_Tr, _CS_Al > * rdbuf() const
basic_streambuf< _CS_cT, _CS_traits >::pos_type pos_type
ios_base::openmode _CS_m_mode
basic_stringbuf(ios_base::openmode=ios_base::in|ios_base::out)