00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00016 #ifndef LOG4CPLUS_STREAMS_HEADER_
00017 #define LOG4CPLUS_STREAMS_HEADER_
00018
00019 #include <log4cplus/config.h>
00020 #include <log4cplus/tstring.h>
00021
00022 #include <iostream>
00023 #ifdef HAVE_SSTREAM
00024 # include <sstream>
00025 # define LOG4CPLUS_STREAM_NAMESPACE std
00026 #elif defined(HAVE_STRSTREAM)
00027 # include <strstream>
00028 # if defined(__DECCXX) && !defined(__USE_STD_IOSTREAM)
00029 # define LOG4CPLUS_STREAM_NAMESPACE
00030 # else
00031 # define LOG4CPLUS_STREAM_NAMESPACE std
00032 # endif
00033 #elif defined(HAVE_STRSTREAM_H)
00034 # include <strstream.h>
00035 # define LOG4CPLUS_STREAM_NAMESPACE
00036 #else
00037 # error "There doesn't appear to be any s*stream headers!!"
00038 #endif
00039
00040 #ifdef UNICODE
00041 namespace log4cplus {
00042 typedef LOG4CPLUS_STREAM_NAMESPACE::wostream tostream;
00043 typedef LOG4CPLUS_STREAM_NAMESPACE::wistream tistream;
00044 typedef LOG4CPLUS_STREAM_NAMESPACE::wostringstream tostringstream;
00045 static tostream &tcout = LOG4CPLUS_STREAM_NAMESPACE::wcout;
00046 static tostream &tcerr = LOG4CPLUS_STREAM_NAMESPACE::wcerr;
00047 }
00048
00049 LOG4CPLUS_EXPORT log4cplus::tostream& operator <<(log4cplus::tostream&, const char* psz );
00050
00051 #else
00052 namespace log4cplus {
00053 typedef LOG4CPLUS_STREAM_NAMESPACE::ostream tostream;
00054 typedef LOG4CPLUS_STREAM_NAMESPACE::istream tistream;
00055 static tostream &tcout = LOG4CPLUS_STREAM_NAMESPACE::cout;
00056 static tostream &tcerr = LOG4CPLUS_STREAM_NAMESPACE::cerr;
00057 #ifdef HAVE_SSTREAM
00058 typedef LOG4CPLUS_STREAM_NAMESPACE::ostringstream tostringstream;
00059 #else
00060 class tostringstream : public LOG4CPLUS_STREAM_NAMESPACE::ostrstream {
00061 public:
00062 tstring str() {
00063 char *ptr = LOG4CPLUS_STREAM_NAMESPACE::ostrstream::str();
00064 if(ptr) {
00065 return tstring(ptr, pcount());
00066 }
00067 else {
00068 return tstring();
00069 }
00070 }
00071 };
00072
00073 #endif // HAVE_SSTREAM
00074 }
00075 #endif // UNICODE
00076
00077 #endif // LOG4CPLUS_STREAMS_HEADER_
00078