18 #ifndef INCLUDE_RCF_MEMSTREAM_HPP 19 #define INCLUDE_RCF_MEMSTREAM_HPP 25 #include <RCF/Config.hpp> 26 #include <RCF/ByteBuffer.hpp> 27 #include <RCF/ReallocBuffer.hpp> 28 #include <RCF/Tools.hpp> 37 public std::streambuf,
41 MemIstreamBuf(
char * buffer = NULL, std::size_t bufferLen = 0);
43 void reset(
char * buffer, std::size_t bufferLen);
46 std::streambuf::int_type underflow();
50 std::ios_base::seekdir dir,
51 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
54 std::size_t mBufferLen;
59 class RCF_EXPORT MemIstream :
60 public std::basic_istream<char>
63 MemIstream(
const char * buffer = NULL, std::size_t bufferLen = 0);
65 void reset(
const char * buffer, std::size_t bufferLen);
69 MemIstreamBuf * mpBuf;
73 std::istream::pos_type getReadPos();
76 void read(
char *_Str, std::streamsize _Count);
77 std::streamsize readsome(
char *_Str, std::streamsize _Count);
78 std::streamsize gcount();
79 void putback(
char _Ch);
80 std::istream::pos_type moveReadPos(std::istream::pos_type newPos);
84 RCF_EXPORT MemIstream & operator>>(MemIstream & is, std::string & s);
85 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
char & ch);
86 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
signed char & ch);
87 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
unsigned char & ch);
88 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
bool & b);
89 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
short & b);
90 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
unsigned short & b);
91 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
int & n);
92 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
unsigned int & n);
93 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
long & n);
94 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
unsigned long & n);
95 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
float & d);
96 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
double & d);
97 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
long double & d);
100 RCF_EXPORT MemIstream & operator>>(MemIstream & is, __int64 & n);
101 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
unsigned __int64 & n);
103 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
long long & n);
104 RCF_EXPORT MemIstream & operator>>(MemIstream & is,
unsigned long long & n);
109 class MemOstreamBuf :
110 public std::streambuf,
118 std::streambuf::int_type overflow(std::streambuf::int_type ch);
122 std::ios_base::seekdir dir,
123 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
125 friend class MemOstream;
126 ReallocBuffer mWriteBuffer;
131 class RCF_EXPORT MemOstream :
132 public std::basic_ostream<char>
139 std::size_t length();
140 std::string string();
142 std::size_t capacity();
146 rdbuf()->pubseekoff(0, std::ios::beg, std::ios::out);
152 MemOstreamBuf * mpBuf;
182 typedef std::shared_ptr<MemOstream> MemOstreamPtr;
187 inline MemOstream & operator<<(MemOstream & os,
const T * pt)
189 static_cast<std::ostream&
>(os) << pt;
194 inline MemOstream & operator<<(MemOstream & os, const std::shared_ptr<T> & pt)
196 static_cast<std::ostream&
>(os) << pt.get();
200 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
const std::string & s);
201 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
const char * sz);
202 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
char ch);
203 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
signed char ch);
204 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
unsigned char ch);
205 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
bool b);
206 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
short b);
207 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
unsigned short b);
208 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
int n);
209 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
unsigned int n);
210 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
long n);
211 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
unsigned long n);
212 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
float d);
213 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
double d);
214 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
long double d);
217 RCF_EXPORT MemOstream & operator<<(MemOstream & os, __int64 n);
218 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
unsigned __int64 n);
220 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
long long n);
221 RCF_EXPORT MemOstream & operator<<(MemOstream & os,
unsigned long long n);
224 typedef std::ostream& (*Pfn)(std::ostream&);
225 RCF_EXPORT MemOstream & operator<<(MemOstream & os, Pfn pfn);
Definition: AmiIoHandler.hpp:23