Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef _BACKWARD_STRSTREAM
00050 #define _BACKWARD_STRSTREAM
00051
00052 #include "backward_warning.h"
00053 #include <iosfwd>
00054 #include <ios>
00055 #include <istream>
00056 #include <ostream>
00057 #include <string>
00058
00059 namespace std _GLIBCXX_VISIBILITY(default)
00060 {
00061 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00062
00063
00064
00065 class strstreambuf : public basic_streambuf<char, char_traits<char> >
00066 {
00067 public:
00068
00069 typedef char_traits<char> _Traits;
00070 typedef basic_streambuf<char, _Traits> _Base;
00071
00072 public:
00073
00074 explicit strstreambuf(streamsize __initial_capacity = 0);
00075 strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
00076
00077 strstreambuf(char* __get, streamsize __n, char* __put = 0) throw ();
00078 strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
00079 strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
00080
00081 strstreambuf(const char* __get, streamsize __n) throw ();
00082 strstreambuf(const signed char* __get, streamsize __n) throw ();
00083 strstreambuf(const unsigned char* __get, streamsize __n) throw ();
00084
00085 virtual ~strstreambuf();
00086
00087 public:
00088 void freeze(bool = true) throw ();
00089 char* str() throw ();
00090 _GLIBCXX_PURE int pcount() const throw ();
00091
00092 protected:
00093 virtual int_type overflow(int_type __c = _Traits::eof());
00094 virtual int_type pbackfail(int_type __c = _Traits::eof());
00095 virtual int_type underflow();
00096 virtual _Base* setbuf(char* __buf, streamsize __n);
00097 virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
00098 ios_base::openmode __mode
00099 = ios_base::in | ios_base::out);
00100 virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
00101 = ios_base::in | ios_base::out);
00102
00103 private:
00104 strstreambuf&
00105 operator=(const strstreambuf&);
00106
00107 strstreambuf(const strstreambuf&);
00108
00109
00110 char* _M_alloc(size_t);
00111 void _M_free(char*);
00112
00113
00114 void _M_setup(char* __get, char* __put, streamsize __n) throw ();
00115
00116 private:
00117
00118 void* (*_M_alloc_fun)(size_t);
00119 void (*_M_free_fun)(void*);
00120
00121 bool _M_dynamic : 1;
00122 bool _M_frozen : 1;
00123 bool _M_constant : 1;
00124 };
00125
00126
00127 class istrstream : public basic_istream<char>
00128 {
00129 public:
00130 explicit istrstream(char*);
00131 explicit istrstream(const char*);
00132 istrstream(char* , streamsize);
00133 istrstream(const char*, streamsize);
00134 virtual ~istrstream();
00135
00136 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
00137 char* str() throw ();
00138
00139 private:
00140 strstreambuf _M_buf;
00141 };
00142
00143
00144 class ostrstream : public basic_ostream<char>
00145 {
00146 public:
00147 ostrstream();
00148 ostrstream(char*, int, ios_base::openmode = ios_base::out);
00149 virtual ~ostrstream();
00150
00151 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
00152 void freeze(bool = true) throw();
00153 char* str() throw ();
00154 _GLIBCXX_PURE int pcount() const throw ();
00155
00156 private:
00157 strstreambuf _M_buf;
00158 };
00159
00160
00161 class strstream : public basic_iostream<char>
00162 {
00163 public:
00164 typedef char char_type;
00165 typedef char_traits<char>::int_type int_type;
00166 typedef char_traits<char>::pos_type pos_type;
00167 typedef char_traits<char>::off_type off_type;
00168
00169 strstream();
00170 strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
00171 virtual ~strstream();
00172
00173 _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
00174 void freeze(bool = true) throw ();
00175 _GLIBCXX_PURE int pcount() const throw ();
00176 char* str() throw ();
00177
00178 private:
00179 strstreambuf _M_buf;
00180 };
00181
00182 _GLIBCXX_END_NAMESPACE_VERSION
00183 }
00184
00185 #endif