X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftracer.h;h=570da31963c59738b409bf178b8906fb2498fa4a;hb=097595d63c8fc0b3e6c17af7545100247f4ee57d;hp=a467efb56896ca22d8831d741dc1f94f0128bb55;hpb=4b2a999762c83627476428e595d3c1e3704a3da0;p=lyx.git diff --git a/src/tracer.h b/src/tracer.h index a467efb568..570da31963 100644 --- a/src/tracer.h +++ b/src/tracer.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -19,23 +19,35 @@ #include "debug.h" #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: + /// 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