ostream& __STL_CALL operator<<(ostream& __os, const basic_string<_CharT,_Traits,_Alloc>& __s) { __STL_USING_VENDOR_STD streambuf* __buf = __os.rdbuf(); if (__buf) { size_t __n = __s.size(); size_t __pad_len = 0; const bool __left = (__os.flags() & ios::left) !=0; const size_t __w = __os.width(); if (__w > 0) { __n = min(__w, __n); __pad_len = __w - __n; } if (!__left) __sgi_string_fill(__os, __buf, __pad_len); const size_t __nwritten = __buf->sputn(__s.data(), __n); if (__left) __sgi_string_fill(__os, __buf, __pad_len); if (__nwritten != __n) __os.clear(__os.rdstate() | ios::failbit); __os.width(0); } else __os.clear(__os.rdstate() | ios::badbit); return __os; }
void Foam::state(ostream& to, const string& s) { state_value osState = state_value(to.rdstate()); switch (osState) { case _good: // Do not anything 'unusual'. break; case _eof: Info << "Output stream: premature end of stream", s << endl; break; case _fail: SeriousErrorIn("state(ostream& to, const string& s)") << "Output stream failure (bad format?)", s << endl; break; case (_fail + _eof) : SeriousErrorIn("state(ostream& to, const string& s)") << "Output stream failure and end of stream", s << endl; break; case _bad: SeriousErrorIn("state(ostream& to, const string& s)") << "Serious output stream failure", s << endl; break; default: SeriousErrorIn("state(ostream& to, const string& s)") << "Output stream failure of unknown type", s << endl << "Stream state value = ", osState << endl; break; } return; }
ostream::ostream(ostream const& rhs) : std::ios(0), base_type(rhs.rdbuf()), impl_(rhs.impl_) { this->copyfmt(rhs); this->clear(rhs.rdstate()); }