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
00050
00051 #ifndef XIMOL_SSTREAM_HPP_
00052 #define XIMOL_SSTREAM_HPP_
00053
00054 #include <ximol/stream.hpp>
00055
00056 #include <sstream>
00057
00058 XIMOL_BEGIN_NAMESPACE
00059
00060
00061
00062
00063 class XIMOL_EXPORT xostringstream
00064 : public xostream
00065 {
00066 public:
00067 explicit xostringstream(std::ios_base::openmode mode = std::ios_base::out);
00068
00069 explicit xostringstream(const ::std::basic_string<xchar_t>& str,
00070 std::ios_base::openmode mode = std::ios_base::out);
00071
00072 ~xostringstream();
00073
00074 public:
00075 ::std::basic_stringbuf<xchar_t>* rdbuf();
00076 ::std::basic_string<xchar_t> str() const;
00077 void str(const ::std::basic_string<xchar_t>& s);
00078
00079 inline xostream& operator<<(xchar_t c) { return xostream::operator<<(c); }
00080 inline xostream& operator<<(char c) { return xostream::operator<<(c); }
00081
00082 private:
00083 ::std::basic_stringbuf<xchar_t> buf_;
00084 };
00085
00086
00087
00088
00089
00090 class XIMOL_EXPORT xistringstream
00091 : public xistream
00092 {
00093 public:
00094 explicit xistringstream(std::ios_base::openmode mode = std::ios_base::in);
00095
00096 explicit xistringstream(const ::std::basic_string<xchar_t>& str,
00097 std::ios_base::openmode mode = std::ios_base::in);
00098
00099 ~xistringstream();
00100
00101 public:
00102 ::std::basic_stringbuf<xchar_t>* rdbuf();
00103 ::std::basic_string<xchar_t> str() const;
00104 void str(const ::std::basic_string<xchar_t>& s);
00105
00106 inline xistream& operator>>(xchar_t& c) { return xistream::operator>>(c); }
00107 inline xistream& operator>>(char& c) { return xistream::operator>>(c); }
00108
00109 private:
00110 ::std::basic_stringbuf<xchar_t> buf_;
00111 };
00112
00113
00114
00115
00116
00117 class XIMOL_EXPORT xstringstream
00118 : public xiostream
00119 {
00120 public:
00121 explicit xstringstream(std::ios_base::openmode mode = std::ios_base::in | out);
00122
00123 explicit xstringstream(const ::std::basic_string<xchar_t>& str,
00124 std::ios_base::openmode mode = std::ios_base::in | out);
00125
00126 ~xstringstream();
00127
00128 public:
00129 ::std::basic_stringbuf<xchar_t>* rdbuf();
00130 ::std::basic_string<xchar_t> str() const;
00131 void str(const ::std::basic_string<xchar_t>& s);
00132
00133 inline xostream& operator<<(xchar_t c) { return xostream::operator<<(c); }
00134 inline xostream& operator<<(char c) { return xostream::operator<<(c); }
00135 inline xistream& operator>>(xchar_t& c) { return xistream::operator>>(c); }
00136 inline xistream& operator>>(char& c) { return xistream::operator>>(c); }
00137
00138 private:
00139 ::std::basic_stringbuf<xchar_t> buf_;
00140 };
00141
00142
00143 XIMOL_END_NAMESPACE
00144
00145 #endif // #ifndef XIMOL_SSTREAM_HPP_