]> git.lyx.org Git - lyx.git/blobdiff - src/tracer.h
fix typo that put too many include paths for most people
[lyx.git] / src / tracer.h
index 1e2ced161e492305a1655de3ce3c8de5436192b5..36908a70f0cf231b120b2b5ea4f2711e5a2916d7 100644 (file)
@@ -1,11 +1,11 @@
 // -*- C++ -*-
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *        
+ *
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
 #include "LString.h"
 
 ///
-class DebugTracer {
+class Trace {
 public:
        ///
        explicit
-       DebugTracer(string const & s) : str(s) {
-               lyxerr << string(depth, ' ') << "Trace begin : "
+       Trace(string const & s) : str(s) {
+               lyxerr << string(depth, ' ') << "TRACE IN: "
                       << str << std::endl;
-               ++depth;
-               
+               depth += 2;
+
        }
        ///
-       ~DebugTracer() {
-               --depth;
-               lyxerr << string(depth, ' ') << "Trace end : "
+       ~Trace() {
+               depth -= 2;
+               lyxerr << string(depth, ' ') << "TRACE OUT: "
                       << str << std::endl;
        }
 private:
@@ -43,4 +43,11 @@ private:
        static int depth;
 };
 
+// To avoid wrong usage:
+// Trace("BufferView::update");  // wrong
+// Trace t("BufferView::update"); // right
+// we add this macro:
+///
+#define Trace(x) unnamed_Trace;
+// Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
 #endif