]> git.lyx.org Git - lyx.git/blobdiff - src/support/debug.h
Fix bug 9798.
[lyx.git] / src / support / debug.h
index d636e4c5c32a3c4d1487a82a3a803e47be86cfd4..f6b06d5c3eeb24e61b39389c7ef54699cc5d803a 100644 (file)
 
 #include "support/strfwd.h"
 
+// Forward definitions do not work with libc++
+// but ios_base has already been defined in strfwd
+// if compiling with it
+#ifndef USE_LLVM_LIBCPP
 namespace std {
 
 class ios_base;
@@ -24,7 +28,8 @@ class ios_base;
 template<typename CharT, typename Traits> class basic_streambuf;
 typedef basic_streambuf<char, char_traits<char> > streambuf;
 
-}
+} // namespace std
+#endif
 
 
 namespace lyx {
@@ -76,7 +81,7 @@ namespace Debug {
                ///
                WORKAREA   = (1 << 19),
                ///
-               INSETTEXT  = (1 << 20),
+               CLIPBOARD  = (1 << 20),
                ///
                GRAPHICS   = (1 << 21),
                /// change tracking
@@ -105,7 +110,7 @@ namespace Debug {
 
        /// Return number of levels
        int levelCount();
+
        /// A function to convert debug level string names numerical values
        Type value(std::string const & val);
 
@@ -137,8 +142,9 @@ inline void operator|=(Debug::Type & d1, Debug::Type d2)
 class LyXErr
 {
 public:
-       LyXErr(): enabled_(true), second_enabled_(false) {}
-       
+       LyXErr(): dt_(Debug::NONE), stream_(0), enabled_(true),
+                 second_stream_(0), second_enabled_(false) {}
+
        /// Disable the stream completely
        void disable();
        /// Enable the stream after a possible call of disable()
@@ -157,9 +163,9 @@ public:
        bool enabled() const { return enabled_; }
 
        /// Returns second stream
-       std::ostream & secondStream() { return *second_stream_; };
+       std::ostream & secondStream() { return *second_stream_; }
        /// Sets second stream
-       void setSecondStream(std::ostream * os) 
+       void setSecondStream(std::ostream * os)
                { second_enabled_ = (second_stream_ = os); }
        /// Is the second stream is enabled?
        bool secondEnabled() { return second_enabled_; }
@@ -171,6 +177,9 @@ public:
        /// Returns true if t is part of the current debug level
        bool debugging(Debug::Type t = Debug::ANY) const;
 
+       ///
+       static char const * stripName(char const *);
+
 private:
        /// The current debug level
        Debug::Type dt_;
@@ -193,6 +202,10 @@ LyXErr & operator<<(LyXErr &, int);
 LyXErr & operator<<(LyXErr &, unsigned int);
 LyXErr & operator<<(LyXErr &, long);
 LyXErr & operator<<(LyXErr &, unsigned long);
+#ifdef LYX_USE_LONG_LONG
+LyXErr & operator<<(LyXErr &, long long);
+LyXErr & operator<<(LyXErr &, unsigned long long);
+#endif
 LyXErr & operator<<(LyXErr &, double);
 LyXErr & operator<<(LyXErr &, std::string const &);
 LyXErr & operator<<(LyXErr &, docstring const &);
@@ -208,7 +221,7 @@ extern LyXErr lyxerr;
 #      include <boost/current_function.hpp>
 #      define CURRENT_POSITION BOOST_CURRENT_FUNCTION ": "
 #else
-# define CURRENT_POSITION __FILE__ << "(" << __LINE__ << "): "
+# define CURRENT_POSITION lyx::LyXErr::stripName(__FILE__) << " (" << __LINE__ << "): "
 #endif
 
 #define LYXERR(type, msg) \