]> git.lyx.org Git - lyx.git/blobdiff - src/support/DebugStream.h
Create a grfx::Loader class and so move large chunks of code out of
[lyx.git] / src / support / DebugStream.h
index b19c4b812b060953a02ee2f3bbdb6e81c52f8340..9ed437600edebddb709db37d12a8e2af6f06a75f 100644 (file)
 #ifndef DEBUGSTREAM_H
 #define DEBUGSTREAM_H
 
+#ifdef __GNUG__
+#pragma interface
+#endif
+
 #include "LOstream.h"
 
 #ifdef TEST_DEBUGSTREAM
 #include <string>
 struct Debug {
-       ///
        enum type {
-               ///
                NONE = 0,
-               ///
                INFO       = (1 << 0),   // 1
-               ///
                WARN       = (1 << 1),   // 2
-               ///
                CRIT       = (1 << 2)   // 4
        };
-       ///
        static const type ANY = type(INFO | WARN | CRIT);
-
-       /** A function to convert symbolic string names on debug levels
-           to their numerical value.
-       */
        static Debug::type value(string const & val) {
                if (val == "NONE") return Debug::NONE;
                if (val == "INFO") return Debug::INFO;
@@ -41,13 +35,12 @@ struct Debug {
                if (val == "CRIT") return Debug::CRIT;
                return Debug::NONE;
        }
-
 };
 #endif
 
-/** DebugStream is a ostream intended for debug output. It has also support
-    for a logfile. Debug output is output to cerr and if the logfile is set,
-    to the logfile.
+/** DebugStream is a ostream intended for debug output.
+    It has also support for a logfile. Debug output is output to cerr
+    and if the logfile is set, to the logfile.
 
     Example of Usage:
     DebugStream debug;
@@ -60,12 +53,12 @@ struct Debug {
     INFO
     Always
 
-    If you want to have debug output from time critical code you should 
+    If you want to have debug output from time critical code you should
     use this construct:
     if (debug.debugging(Debug::INFO)) {
-         debug << "...debug output...\n";
+        debug << "...debug output...\n";
     }
-    
+
     To give debug info even if no debug (NONE) is requested:
     debug << "... always output ...\n";
 
@@ -82,26 +75,19 @@ struct Debug {
     debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
 
 */
-
-// This workaround is needed only for gcc 2.8.1 (and possibly egcs
-// 1.0.x), which generates a compiler error when subclassing from
-// std::. (JMarc)
-#ifdef CXX_WORKING_NAMESPACES
-class DebugStream : public std::ostream {
-#else
-class DebugStream : public ostream {
-#endif
+class DebugStream : public std::ostream
+{
 public:
        /// Constructor, sets the debug level to t.
        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);
 
        ///
-       virtual ~DebugStream();
-       
+       ~DebugStream();
+
        /// Sets the debug level to t.
        void level(Debug::type t) {
                dt = Debug::type(t & Debug::ANY);
@@ -124,7 +110,7 @@ public:
 
        /// Sets the debugstreams' logfile to f.
        void logFile(char const * f);
-       
+
        /// Returns true if t is part of the current debug level.
        bool debugging(Debug::type t = Debug::ANY) const
        {
@@ -132,7 +118,7 @@ public:
                return false;
        }
 
-       
+
        /** Returns the no-op stream if t is not part of the
            current debug level otherwise the real debug stream
            is used.
@@ -142,7 +128,7 @@ public:
                return nullstream;
        }
 
-       
+
        /** This is an operator to give a more convenient use:
            dbgstream[Debug::INFO] << "Info!\n";
        */
@@ -154,7 +140,9 @@ private:
        Debug::type dt;
        /// The no-op stream.
        std::ostream nullstream;
+       ///
        struct debugstream_internal;
+       ///
        debugstream_internal * internal;
 };