29#ifndef PT_STRINGSTREAM_H
30#define PT_STRINGSTREAM_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
79 void swap(StringBuffer& other);
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)
125class PT_API IStringStream :
public std::basic_istream<Pt::Char>
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); }
158class PT_API OStringStream :
public std::basic_ostream<Pt::Char>
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); }
191class PT_API StringStream :
public std::basic_iostream<Pt::Char>
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); }
BasicStreamBuffer()
Definition StreamBuffer.h:139
Unicode string input stream.
Definition StringStream.h:126
Unicode string output stream.
Definition StringStream.h:159
Unicode string stream buffer.
Definition StringStream.h:45
traits_type::off_type off_type
Stream offset type.
Definition StringStream.h:62
Char char_type
Internal character type.
Definition StringStream.h:50
std::char_traits< Char > traits_type
Internal character traits.
Definition StringStream.h:53
traits_type::pos_type pos_type
Stream position type.
Definition StringStream.h:59
traits_type::int_type int_type
Integer type.
Definition StringStream.h:56
virtual std::streamsize showfull() override
Returns the number of characters buffered for output.
Unicode string stream.
Definition StringStream.h:192
Unicode capable basic_string.
Definition Api-String.h:67
Core module.
Definition Allocator.h:33
Unicode character type.
Definition String.h:67