]> git.lyx.org Git - lyx.git/blob - src/tracer.h
Reverted the reverted changes - 1.
[lyx.git] / src / tracer.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef TRACER_H
13 #define TRACER_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "debug.h"
20 #include "LString.h"
21
22 ///
23 class Trace {
24 public:
25         ///
26         explicit
27         Trace(string const & s) : str(s) {
28                 lyxerr << string(depth, ' ') << "TRACE IN: "
29                        << str << std::endl;
30                 depth += 2;
31                 
32         }
33         ///
34         ~Trace() {
35                 depth -= 2;
36                 lyxerr << string(depth, ' ') << "TRACE OUT: "
37                        << str << std::endl;
38         }
39 private:
40         ///
41         string str;
42         ///
43         static int depth;
44 };
45
46 // To avoid wrong usage:
47 // Trace("BufferView::update");  // wrong
48 // Trace t("BufferView::update"); // right
49 // we add this macro:
50 ///
51 #define Trace(x) unnamed_Trace;
52 // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
53 #endif