32 lines
672 B
Plaintext
32 lines
672 B
Plaintext
|
|
#ifndef __SG_SSTREAM
|
|
#define __SG_SSTREAM 1
|
|
|
|
# include <iostream>
|
|
# include <strstream>
|
|
# include <string>
|
|
|
|
namespace std {
|
|
|
|
class ostringstream : public strstreambase, public iostream {
|
|
private:
|
|
std::ostrstream *sstr;
|
|
|
|
public:
|
|
ostringstream() { sstr = new std::ostrstream; }
|
|
ostringstream(const string &str, int mode=ios::out) {
|
|
sstr = new ostrstream((char *)str.c_str(), str.size(), mode);
|
|
}
|
|
~ostringstream() { delete sstr; }
|
|
std::string str() { return std::string(sstr->str()); }
|
|
int pcount() { return sstr->pcount(); }
|
|
};
|
|
|
|
class istringstream : public istrstream {
|
|
};
|
|
|
|
};
|
|
|
|
#endif // !__SG_SSTREAM
|
|
|