X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftracer.h;h=36908a70f0cf231b120b2b5ea4f2711e5a2916d7;hb=98c966c64594611e469313314abd1e59524adb4a;hp=47c13f09449a2544c2ab01ceac259794cbb02b9c;hpb=601889d75d3cd03b9992e088de4e1ba50a10c342;p=lyx.git diff --git a/src/tracer.h b/src/tracer.h index 47c13f0944..36908a70f0 100644 --- a/src/tracer.h +++ b/src/tracer.h @@ -1,23 +1,53 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. + * + * ====================================================== */ + #ifndef TRACER_H #define TRACER_H +#ifdef __GNUG__ +#pragma interface +#endif + #include "debug.h" #include "LString.h" -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