00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00018 #ifndef LIBCWD_PRIVATE_BUFFERSTREAM_H
00019 #define LIBCWD_PRIVATE_BUFFERSTREAM_H
00020
00021 #ifndef LIBCWD_CONFIG_H
00022 #include <libcwd/config.h>
00023 #endif
00024
00025 namespace libcwd {
00026 namespace _private_ {
00027
00028
00029
00030 class bufferstream_ct : public std::ostream
00031 {
00032 public:
00033 typedef char char_type;
00034 typedef std::char_traits<char> traits_type;
00035 #if CWDEBUG_ALLOC
00036 typedef auto_internal_allocator allocator_type;
00037 #else
00038 typedef ::std::allocator<char_type> allocator_type;
00039 #endif
00040 typedef traits_type::int_type int_type;
00041 typedef traits_type::pos_type pos_type;
00042 typedef traits_type::off_type off_type;
00043 typedef std::basic_string<char_type, traits_type, allocator_type> string_type;
00044 typedef std::basic_stringbuf<char_type, traits_type, allocator_type> stringbuf_type;
00045
00046 public:
00047 stringbuf_type* M_stringbuf;
00048
00049 public:
00050 explicit
00051 bufferstream_ct(stringbuf_type* sb) : std::basic_ostream<char, std::char_traits<char> >(sb), M_stringbuf(sb) { }
00052 ~bufferstream_ct() { }
00053
00054 stringbuf_type* rdbuf(void) const { return M_stringbuf; }
00055 string_type str(void) const { return M_stringbuf->str(); }
00056 void str(string_type const& s) { M_stringbuf->str(s); }
00057 };
00058
00059 }
00060 }
00061
00062 #endif // LIBCWD_PRIVATE_BUFFERSTREAM_H