1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class charT, class traits = char_traits<charT> >
13 // class basic_ostream;
15 // basic_ostream<charT,traits>& operator<<(ios_base& (*pf)(ios_base&));
20 template <class CharT>
22 : public std::basic_streambuf<CharT>
24 typedef std::basic_streambuf<CharT> base;
25 std::basic_string<CharT> str_;
31 std::basic_string<CharT> str() const
32 {return std::basic_string<CharT>(base::pbase(), base::pptr());}
36 virtual typename base::int_type
37 overflow(typename base::int_type __c = base::traits_type::eof())
39 if (__c != base::traits_type::eof())
41 int n = static_cast<int>(str_.size());
42 str_.push_back(static_cast<CharT>(__c));
43 str_.resize(str_.capacity());
44 base::setp(const_cast<CharT*>(str_.data()),
45 const_cast<CharT*>(str_.data() + str_.size()));
57 assert(!(os.flags() & std::ios_base::uppercase));
59 assert( (os.flags() & std::ios_base::uppercase));