29 #ifndef PT_STRINGSTREAM_H
30 #define PT_STRINGSTREAM_H
33 #include <Pt/String.h>
34 #include <Pt/StreamBuffer.h>
35 #include <Pt/IOStream.h>
56 typedef typename traits_type::int_type
int_type;
59 typedef typename traits_type::pos_type
pos_type;
62 typedef typename traits_type::off_type
off_type;
65 explicit StringBuffer(std::ios::openmode mode = std::ios::in|std::ios::out);
68 std::ios::openmode mode = std::ios::in|std::ios::out);
76 #if __cplusplus >= 201103L
85 virtual std::streamsize showmanyc()
override;
87 virtual int sync()
override;
91 virtual int_type underflow()
override;
95 virtual std::streamsize xsgetn(
char_type* s, std::streamsize n)
override;
97 virtual std::streamsize xsputn(
const char_type* s, std::streamsize n)
override;
100 std::ios_base::openmode m = std::ios_base::in|std::ios_base::out)
override;
103 std::ios_base::openmode m = std::ios_base::in|std::ios_base::out)
override;
106 std::ios_base::openmode _mode;
108 std::streamsize _hwm;
111 #if defined(PT_WITH_STD_STRINGSTREAM)
129 typedef std::char_traits<Pt::Char> traits_type;
130 typedef std::allocator<Pt::Char> allocator_type;
131 typedef traits_type::int_type int_type;
132 typedef traits_type::pos_type pos_type;
133 typedef traits_type::off_type off_type;
136 explicit IStringStream(std::ios_base::openmode mode = ios_base::in);
139 std::ios_base::openmode mode = std::ios_base::in);
145 {
return _buffer.str(); }
148 { _buffer.str(str); }
162 typedef std::char_traits<Pt::Char> traits_type;
163 typedef std::allocator<Pt::Char> allocator_type;
164 typedef traits_type::int_type int_type;
165 typedef traits_type::pos_type pos_type;
166 typedef traits_type::off_type off_type;
169 explicit OStringStream(std::ios_base::openmode mode = ios_base::out);
172 std::ios_base::openmode mode = std::ios_base::out);
178 {
return _buffer.str(); }
181 { _buffer.str(str); }
195 typedef std::char_traits<Pt::Char> traits_type;
196 typedef std::allocator<Pt::Char> allocator_type;
197 typedef traits_type::int_type int_type;
198 typedef traits_type::pos_type pos_type;
199 typedef traits_type::off_type off_type;
202 explicit StringStream(std::ios_base::openmode mode = ios_base::in | ios_base::out);
205 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
211 {
return _buffer.str(); }
214 { _buffer.str(str); }
220 #endif // PT_WITH_STD_STRINGSTREAM