]> git.lyx.org Git - lyx.git/blobdiff - src/support/DebugStream.h
use more explicit on constructors use the pimpl idom to reduce size with about 500k
[lyx.git] / src / support / DebugStream.h
index 6fb383ed9fb91fa63585d56bdd47e50824e03e75..9e87488a087a0ecd212e983ca9e97997f093edb4 100644 (file)
@@ -2,7 +2,7 @@
 
 // Created by Lars Gullik Bjønnes
 // Copyright 1999 Lars Gullik Bjønnes (larsbj@lyx.org)
-// Released under the Gnu General Public License
+// Released into the public domain.
 
 // Implemented and tested on g++ 2.7.2.3
 
 #ifndef DEBUGSTREAM_H
 #define DEBUGSTREAM_H
 
-#ifdef _STANDARD_C_PLUS_PLUS
-#define MODERN_STL
-#endif
-
-#ifdef MODERN_STL
-#include <ostream>
-#else
-#include <iostream>
-#endif
-
-//#ifdef MODERN_STL
-using std::ostream;
-using std::streambuf;
-using std::streamsize;
-using std::filebuf;
-using std::cerr;
-using std::ios;
-using std::endl; 
-//#endif
+#include "LOstream.h"
 
 #ifdef TEST_DEBUGSTREAM
 #include <string>
@@ -52,7 +34,7 @@ struct Debug {
        /** A function to convert symbolic string names on debug levels
            to their numerical value.
        */
-       static Debug::type value(std::string const & val) {
+       static Debug::type value(string const & val) {
                if (val == "NONE") return Debug::NONE;
                if (val == "INFO") return Debug::INFO;
                if (val == "WARN") return Debug::WARN;
@@ -100,12 +82,13 @@ struct Debug {
     debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
 
 */
-class DebugStream : public ostream {
+class DebugStream : public std::ostream {
 public:
        /// Constructor, sets the debug level to t.
-       DebugStream(Debug::type t = Debug::NONE);
+       explicit DebugStream(Debug::type t = Debug::NONE);
        
        /// Constructor, sets the log file to f, and the debug level to t.
+       explicit
        DebugStream(char const * f, Debug::type t = Debug::NONE);
 
        ///
@@ -146,7 +129,7 @@ public:
            current debug level otherwise the real debug stream
            is used.
        */
-       ostream & debug(Debug::type t = Debug::ANY) {
+       std::ostream & debug(Debug::type t = Debug::ANY) {
                if (dt & t) return *this;
                return nullstream;
        }
@@ -155,14 +138,14 @@ public:
        /** This is an operator to give a more convenient use:
            dbgstream[Debug::INFO] << "Info!\n";
        */
-       ostream & operator[](Debug::type t) {
+       std::ostream & operator[](Debug::type t) {
                return debug(t);
        }
 private:
        /// The current debug level
        Debug::type dt;
        /// The no-op stream.
-       ostream nullstream;
+       std::ostream nullstream;
        struct debugstream_internal;
        debugstream_internal * internal;
 };