• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // (C) Copyright 2013 Vicente J. Botet Escriba
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 
7 #ifndef BOOST_THREAD_OSTREAM_BUFFER_HPP
8 #define BOOST_THREAD_OSTREAM_BUFFER_HPP
9 
10 #include <boost/thread/detail/config.hpp>
11 #include <boost/thread/detail/delete.hpp>
12 #include <sstream>
13 
14 #include <boost/config/abi_prefix.hpp>
15 
16 namespace boost
17 {
18 
19   template <typename OStream>
20   class ostream_buffer
21   {
22   public:
23     typedef std::basic_ostringstream<typename OStream::char_type, typename OStream::traits_type> stream_type;
ostream_buffer(OStream & os)24     ostream_buffer(OStream& os) :
25       os_(os)
26     {
27     }
~ostream_buffer()28     ~ostream_buffer()
29     {
30       os_ << o_str_.str();
31     }
stream()32     stream_type& stream()
33     {
34       return o_str_;
35     }
36   private:
37     OStream& os_;
38     stream_type o_str_;
39   };
40 
41 }
42 
43 #include <boost/config/abi_suffix.hpp>
44 
45 #endif // header
46