10#ifndef LIBCWD_PRIVATE_BUFFERSTREAM_H
11#define LIBCWD_PRIVATE_BUFFERSTREAM_H
15#ifndef HIDE_FROM_DOXYGEN
16namespace libcwd::_private_ {
20class BufferStream :
public std::ostream
23 using char_type = char;
24 using traits_type = std::char_traits<char>;
25 using allocator_type = ::std::allocator<char_type>;
26 using int_type = traits_type::int_type;
27 using pos_type = traits_type::pos_type;
28 using off_type = traits_type::off_type;
29 using string_type = std::basic_string<char_type, traits_type, allocator_type>;
30 using stringbuf_type = std::basic_stringbuf<char_type, traits_type, allocator_type>;
33 stringbuf_type* stringbuf_;
36 explicit BufferStream(stringbuf_type* sb) : std::basic_ostream<char, std::char_traits<char>>(sb), stringbuf_(sb) { }
39 stringbuf_type* rdbuf()
const {
return stringbuf_; }
40 string_type str()
const {
return stringbuf_->str(); }
41 void str(string_type
const& s) { stringbuf_->str(s); }