]> git.lyx.org Git - lyx.git/blob - src/tracer.h
"Inter-word Space"
[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-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef TRACER_H
13 #define TRACER_H
14
15 #include "debug.h"
16 #include "LString.h"
17
18 ///
19 class Trace {
20 public:
21         ///
22         explicit
23         Trace(string const & s) : str(s) {
24                 lyxerr << string(depth, ' ') << "TRACE IN: "
25                        << str << std::endl;
26                 depth += 2;
27
28         }
29         ///
30         ~Trace() {
31                 depth -= 2;
32                 lyxerr << string(depth, ' ') << "TRACE OUT: "
33                        << str << std::endl;
34         }
35 private:
36         ///
37         string str;
38         ///
39         static int depth;
40 };
41
42 // To avoid wrong usage:
43 // Trace("BufferView::update");  // wrong
44 // Trace t("BufferView::update"); // right
45 // we add this macro:
46 ///
47 #define Trace(x) unnamed_Trace;
48 // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
49 #endif