fake_ostringstream.hh

Go to the documentation of this file.
00001 #ifndef FAKE_OSTRING_STREAM_H
00002 #define FAKE_OSTRING_STREAM_H
00003 
00004 #include <savant-config.h>
00005 #include <strstream.h>
00006 #include <string>
00007 using std::string;
00008 
00020 class fake_ostringstream : public ostrstream {
00021 public:
00022   fake_ostringstream(){}
00023   ~fake_ostringstream(){}
00024 
00025   string str () const {
00026     *(const_cast<fake_ostringstream *>(this)) << ends;
00027     char *foo = const_cast<fake_ostringstream *>(this)->ostrstream::str();
00028     return string(foo);
00029     // Note that we can't safely delete "foo" as str could get called multiple
00030     // times and we need to keep returning the same stream.
00031   }
00032 
00033 private:
00034   
00035 };
00036 
00037 #endif

Generated on Fri Mar 31 11:04:13 2006 for Savant by  doxygen 1.4.6