You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2007/11/08 20:04:22 UTC

svn commit: r593258 - in /logging/log4cxx/trunk/src/main: cpp/logstream.cpp include/log4cxx/stream.h

Author: carnold
Date: Thu Nov  8 11:04:21 2007
New Revision: 593258

URL: http://svn.apache.org/viewvc?rev=593258&view=rev
Log:
LOGCXX-18: works with VC6

Modified:
    logging/log4cxx/trunk/src/main/cpp/logstream.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/stream.h

Modified: logging/log4cxx/trunk/src/main/cpp/logstream.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/logstream.cpp?rev=593258&r1=593257&r2=593258&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/logstream.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/logstream.cpp Thu Nov  8 11:04:21 2007
@@ -23,7 +23,13 @@
 
 logstream_base::logstream_ios_base::logstream_ios_base(std::ios_base::fmtflags initval, 
                     int initsize) {
+#if defined(_MSC_VER)
+	//
+	//    the destructor for std::ios_base in the MSVC STL
+	//        releases a pointer that was not initialized in the constructor.
+	//
     memset(this, 0, sizeof(*this));
+#endif
     flags(initval);
     precision(initsize);
     width(initsize);
@@ -75,10 +81,6 @@
 }
 
 
-logstream_base& logstream_base::nop(logstream_base& stream) {
-     return stream;
-}
-
 
 int log4cxx::logstream_base::precision(int p) {
     get_stream_state(initclear, initset, fillchar, fillset);
@@ -199,13 +201,6 @@
    setLocation(newlocation);
    return *this;
 }
-
-logstream& logstream::operator>>(const log4cxx::spi::LocationInfo& newlocation) {
-   setLocation(newlocation);
-   return *this;
-}
-
-
 
              
 logstream& logstream::operator<<(std::ios_base& (*manip)(std::ios_base&)) {

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/stream.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/stream.h?rev=593258&r1=593257&r2=593258&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/stream.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/stream.h Thu Nov  8 11:04:21 2007
@@ -105,10 +105,6 @@
               */
              void end_message();
 
-              /**
-              *  no operation manipulator, used to workaround compiler defects.
-              */
-             static logstream_base& nop(logstream_base&);
 
             
              /**
@@ -262,24 +258,6 @@
              */
              logstream& operator<<(const log4cxx::spi::LocationInfo& location);
             
-            /**
-             *   Alias for insertion operator for location.  Kludge to avoid
-			 *      inappropriate compiler ambiguity.
-             */
-             logstream& operator>>(const log4cxx::spi::LocationInfo& location);
-            
-            /**
-             *  Template to allow any class with an std::basic_ostream inserter
-             *    to be applied to this class.
-             */
-            template <class V>
-            inline logstream& operator<<(const V& val) {
-                 if (LOG4CXX_UNLIKELY(isEnabled())) {
-                     ((std::basic_ostream<Ch>&) *this) << val;
-                 }
-                 return *this;
-            }
-            
 
             /**
              *   Cast operator to provide access to embedded std::basic_ostream.
@@ -375,18 +353,6 @@
              */
              wlogstream& operator>>(const log4cxx::spi::LocationInfo& location);
             
-            /**
-             *  Template to allow any class with an std::basic_ostream inserter
-             *    to be applied to this class.
-             */
-            template <class V>
-            inline wlogstream& operator<<(const V& val) {
-                 if (LOG4CXX_UNLIKELY(isEnabled())) {
-                     ((std::basic_ostream<Ch>&) *this) << val;
-                 }
-                 return *this;
-            }
-            
 
             /**
              *   Cast operator to provide access to embedded std::basic_ostream.
@@ -429,12 +395,34 @@
 }  // namespace log4cxx
 
 
+/**
+ *  Template to allow any class with an std::basic_ostream inserter
+ *    to be applied to this class.
+ */
+template <class V>
+inline log4cxx::logstream& operator<<(log4cxx::logstream& os, const V& val) {
+     if (LOG4CXX_UNLIKELY(os.isEnabled())) {
+         ((std::basic_ostream<char>&) os) << val;
+     }
+     return os;
+}
+
+#if LOG4CXX_HAS_WCHAR_T            
+/**
+ *  Template to allow any class with an std::basic_ostream inserter
+ *    to be applied to this class.
+ */
+template <class V>
+inline log4cxx::wlogstream& operator<<(log4cxx::wlogstream& os, const V& val) {
+     if (LOG4CXX_UNLIKELY(os.isEnabled())) {
+         ((std::basic_ostream<wchar_t>&) os) << val;
+     }
+     return os;
+}
+#endif
+
 #if !defined(LOG4CXX_ENDMSG)
-#if defined(_MSC_VER) && _MSC_VER <= 1200
 #define LOG4CXX_ENDMSG LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg;
-#else
-#define LOG4CXX_ENDMSG LOG4CXX_LOCATION << log4cxx::logstream_base::endmsg;
-#endif
 #endif