std::streamsize xsputn(const char_type* s, std::streamsize n) { typedef typename string_type::size_type size_type; BOOST_ASSERT(string != nullptr); basic_ostringstreambuf::sync(); const size_type max_size_left = string->max_size() - string->size(); if (static_cast<size_type>(n) < max_size_left) { string->append(s, static_cast<size_type>(n)); return n; } string->append(s, max_size_left); return static_cast<std::streamsize>(max_size_left); }
//! Puts a character sequence to the string std::streamsize xsputn(const char_type* s, std::streamsize n) { BOOST_ASSERT(m_Storage != 0); basic_ostringstreambuf::sync(); typedef typename string_type::size_type string_size_type; register const string_size_type max_storage_left = m_Storage->max_size() - m_Storage->size(); if (static_cast< string_size_type >(n) < max_storage_left) { m_Storage->append(s, static_cast< string_size_type >(n)); return n; } else { m_Storage->append(s, max_storage_left); return static_cast< std::streamsize >(max_storage_left); } }
int sync() { BOOST_ASSERT(string != nullptr); char_type* pbase = this->pbase(); char_type* pptr = this->pptr(); if (pbase != pptr) { string->append(pbase, pptr); this->pbump(static_cast<int>(pbase - pptr)); } return 0; }
//! Puts all buffered data to the string int sync() { BOOST_ASSERT(m_Storage != 0); register char_type* pBase = this->pbase(); register char_type* pPtr = this->pptr(); if (pBase != pPtr) { m_Storage->append(pBase, pPtr); this->pbump(static_cast< int >(pBase - pPtr)); } return 0; }
// Write to a wstring void write(string_type& s, const char_type* from, const char_type* to) { assert(from <= to); s.append(from, to); }
static void append(string_type& str, const char* f, const char* l) { str.append(f, l); }