]> git.lyx.org Git - lyx.git/blobdiff - src/tracer.h
Reverted the reverted changes - 1.
[lyx.git] / src / tracer.h
index bcde291ee02e525d6dddb0232d91be651922d678..b01f652f800213d15b7b72478ee2e96fb883512d 100644 (file)
@@ -1,28 +1,53 @@
 // -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ * 
+ *           LyX, The Document Processor
+ *        
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
 #ifndef TRACER_H
 #define TRACER_H
 
+#ifdef __GNUG__
+#pragma interface
+#endif
+
 #include "debug.h"
 #include "LString.h"
 
-using std::endl;
-
-class DebugTracer {
+///
+class Trace {
 public:
-       DebugTracer(string const & s) : str(s) {
-               lyxerr << string(depth, ' ') << "Trace begin : "
-                      << str << endl;
-               ++depth;
+       ///
+       explicit
+       Trace(string const & s) : str(s) {
+               lyxerr << string(depth, ' ') << "TRACE IN: "
+                      << str << std::endl;
+               depth += 2;
                
        }
-       ~DebugTracer() {
-               --depth;
-               lyxerr << string(depth, ' ') << "Trace end : "
-                      << str << endl;
+       ///
+       ~Trace() {
+               depth -= 2;
+               lyxerr << string(depth, ' ') << "TRACE OUT: "
+                      << str << std::endl;
        }
 private:
+       ///
        string str;
+       ///
        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