gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h
Date: Fri, 08 Dec 2006 12:56:29 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/12/08 12:56:29

Modified files:
        .              : ChangeLog 
        libbase        : log.cpp log.h 

Log message:
                * libbase/log.{cpp,h}: add a templated operator << for
                  printing *any* class that has an output operator defined.
                  It could replace most operator<< methods, but I won't go
                  there for now... just happy with derived Range2d printing 
facility.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1891&r2=1.1892
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.cpp?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.h?cvsroot=gnash&r1=1.36&r2=1.37

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1891
retrieving revision 1.1892
diff -u -b -r1.1891 -r1.1892
--- ChangeLog   8 Dec 2006 12:01:52 -0000       1.1891
+++ ChangeLog   8 Dec 2006 12:56:28 -0000       1.1892
@@ -1,5 +1,9 @@
 2006-12-08 Sandro Santilli <address@hidden>
 
+       * libbase/log.{cpp,h}: add a templated operator << for
+         printing *any* class that has an output operator defined.
+         It could replace most operator<< methods, but I won't go
+         there for now... just happy with derived Range2d printing facility.
        * testsuite/{samples,movies.all,misc-ming.all}/Makefile.am:
          add libtestsuite.la to DEPENDENCIES of test runners.
        * libgeometry/Range2d.h: properly inlined specialized

Index: libbase/log.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- libbase/log.cpp     6 Dec 2006 10:58:34 -0000       1.38
+++ libbase/log.cpp     8 Dec 2006 12:56:29 -0000       1.39
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: log.cpp,v 1.38 2006/12/06 10:58:34 strk Exp $ */
+/* $Id: log.cpp,v 1.39 2006/12/08 12:56:29 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -532,7 +532,7 @@
 
 /// \brief print an STL string
 LogFile& 
-LogFile::operator << (std::string &s)
+LogFile::operator << (const std::string &s)
 {
     scoped_lock lock(io_mutex);
     if (_verbose) {

Index: libbase/log.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- libbase/log.h       11 Nov 2006 14:36:33 -0000      1.36
+++ libbase/log.h       8 Dec 2006 12:56:29 -0000       1.37
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: log.h,v 1.36 2006/11/11 14:36:33 strk Exp $ */
+/* $Id: log.h,v 1.37 2006/12/08 12:56:29 strk Exp $ */
 
 #ifndef GNASH_LOG_H
 #define GNASH_LOG_H
@@ -26,9 +26,11 @@
 #include "config.h"
 #endif
 
-#include <fstream>
 #include "tu_config.h"
 
+#include <fstream>
+#include <sstream>
+
 // the default name for the debug log
 #define DEFAULT_LOGFILE "gnash-dbg.log"
 #define TIMESTAMP_LENGTH 24             // timestamp length
@@ -92,11 +94,26 @@
     LogFile& operator << (void *);
     LogFile& operator << (const char *);
     LogFile& operator << (unsigned char const *);
-    LogFile& operator << (std::string &s);
+    LogFile& operator << (const std::string &s);
 // #ifdef HAVE_LIBXML
 //     LogFile& operator << (const xmlChar *c);
 // #endif
     LogFile& operator << (std::ostream & (&)(std::ostream &));
+
+    /// Print anything that can be printed on a stringstream
+    //
+    /// This template function could replace ALL but
+    /// operator << (const std::string&) members of
+    /// LogFile class.
+    ///
+    template <class T>
+    LogFile& operator << (const T& any)
+    {
+           std::stringstream ss;
+           ss << any;
+           return *this << ss.str();
+    }
+
     const char *getEntry(void);
     
     bool openLog(const char *filespec);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]