Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
 //! 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);
     }
 }