Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

StreamWrapper.h

Go to the documentation of this file.
00001 #ifndef STREAMWRAPPER_H
00002 #define STREAMWRAPPER_H
00003 #include <sstream>
00004 #include <abuse/RefCounted.h>
00005 #ifdef _DEBUG
00006 #include <abuse/abuse.h>
00007 #endif
00008 
00009 template<typename T>
00010 class StreamWrapper: public VirtStream
00011 {
00012  public:
00013   virtual VirtStream& operator<<(end e)
00014     {
00015 //fixme: workaround
00016       //m_pStream<<e(*this);
00017       e(*this);
00018       return *this;
00019     }
00020   virtual VirtStream& operator<<(const char* c)
00021     {
00022       m_pStream<<c;
00023       return *this;
00024     }
00025   virtual VirtStream& operator<<(const std::string& s)
00026     {
00027       m_pStream<<s;
00028       return *this;
00029     }
00030   virtual VirtStream& operator<<(int n)
00031     {
00032       m_pStream<<n;
00033       return *this;
00034     }
00035   virtual VirtStream& operator<<(double n)
00036     {
00037       m_pStream<<n;
00038       return *this;
00039     }
00040   virtual VirtStream& operator<<(char c)
00041     {
00042       m_pStream<<c;
00043       return *this;
00044     }
00045   virtual VirtStream* clone()
00046     {
00047       return new StreamWrapper(*this);
00048     }
00049   virtual VirtStream& endl()
00050     {
00051       m_pStream<<std::endl;
00052       return *this;
00053     }
00054   StreamWrapper(std::basic_ostream<T>& str):m_pStream(str){}
00055  private:
00056   std::basic_ostream<T>& m_pStream;
00057 };
00058 
00059 
00060 #endif

Generated on Thu Jun 16 00:13:14 2005 for Netlib for Abuse! by  doxygen 1.4.3