Author: carnold
Date: Fri Nov  9 10:56:57 2007
New Revision: 593623

URL: http://svn.apache.org/viewvc?rev=593623&view=rev
Log:
LOGCXX-18: Add explicit insertions for built-in types to minimize use of 
templated insertions

Modified:
    logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h

Modified: logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp?rev=593623&r1=593622&r2=593623&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp Fri Nov  9 10:56:57 
2007
@@ -87,6 +87,16 @@
        return s;
 }
 
+std::ostream& CharMessageBuffer::operator<<(bool val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(short val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(int val) { return ((std::ostream&) 
*this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(unsigned int val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(long val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(unsigned long val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(float val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(double val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(long double val) { return 
((std::ostream&) *this).operator<<(val); }
+std::ostream& CharMessageBuffer::operator<<(void* val) { return 
((std::ostream&) *this).operator<<(val); }
 
 
 #if LOG4CXX_HAS_WCHAR_T
@@ -157,6 +167,17 @@
        return s;
 }
 
+std::wostream& WideMessageBuffer::operator<<(bool val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(short val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(int val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(unsigned int val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(long val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(unsigned long val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(float val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(double val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(long double val) { return 
((std::wostream&) *this).operator<<(val); }
+std::wostream& WideMessageBuffer::operator<<(void* val) { return 
((std::wostream&) *this).operator<<(val); }
+
 
 MessageBuffer::MessageBuffer()  : wbuf(0){
 }
@@ -220,5 +241,17 @@
 const std::wstring& MessageBuffer::str(std::wostream& os) {
        return wbuf->str(os);
 }
+
+std::ostream& MessageBuffer::operator<<(bool val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(short val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(int val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(unsigned int val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(long val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(unsigned long val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(float val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(double val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(long double val) { return 
cbuf.operator<<(val); }
+std::ostream& MessageBuffer::operator<<(void* val) { return 
cbuf.operator<<(val); }
+
 
 #endif

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h?rev=593623&r1=593622&r2=593623&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h Fri 
Nov  9 10:56:57 2007
@@ -72,6 +72,67 @@
          *   @return encapsulated STL stream.
          */
         std::ostream& operator<<(ios_base_manip manip);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(bool val);
+
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(short val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(int val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(unsigned int val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(long val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(unsigned long val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(float val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(double val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(long double val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(void* val);
 
                /**
                 *  Cast to ostream.
@@ -117,11 +178,11 @@
          */
         std::basic_ostringstream<char>* stream;
    };
-
+
 template<class V>
 std::basic_ostream<char>& operator<<(CharMessageBuffer& os, const V& val) {
        return ((std::basic_ostream<char>&) os) << val;
-}
+}
 
 #if LOG4CXX_HAS_WCHAR_T
    /**
@@ -166,7 +227,69 @@
          *   @param manip manipulator.
          *   @return encapsulated STL stream.
          */
-        std::wostream& operator<<(ios_base_manip manip);
+        std::wostream& operator<<(ios_base_manip manip);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(bool val);
+
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(short val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(int val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(unsigned int val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(long val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(unsigned long val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(float val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(double val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(long double val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::wostream& operator<<(void* val);
+
 
         /**
                 *  Cast to ostream.
@@ -218,7 +341,6 @@
        return ((std::basic_ostream<wchar_t>&) os) << val;
 }
 
-
    /**
     *   This class is used by the LOG4CXX_INFO and similar
     *   macros to support insertion operators in the message parameter.
@@ -307,7 +429,68 @@
          *   @return encapsulated STL stream.
          */
         std::ostream& operator<<(ios_base_manip manip);
-
+
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(bool val);
+
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(short val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(int val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(unsigned int val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(long val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(unsigned long val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(float val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(double val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(long double val);
+        /**
+         *   Insertion operator for built-in type.
+         *   @param val build in type.
+         *   @return encapsulated STL stream.
+         */
+        std::ostream& operator<<(void* val);
                /**
                 *   Get content of buffer.
                 *   @param buf used only to signal
@@ -350,11 +533,11 @@
          */
         WideMessageBuffer* wbuf;        
    };
-
+
 template<class V>
 std::ostream& operator<<(MessageBuffer& os, const V& val) {
        return ((std::ostream&) os) << val;
-}
+}
 
 #if LOG4CXX_LOGCHAR_IS_UTF8
 typedef CharMessageBuffer LogCharMessageBuffer;


Reply via email to