X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftracer.h;h=b01f652f800213d15b7b72478ee2e96fb883512d;hb=e7ae04343eeb55d92b52c979c2fd5f5ea54ccf38;hp=bcde291ee02e525d6dddb0232d91be651922d678;hpb=85798535a19919e82cc94a177a8414c542a9c5bf;p=lyx.git diff --git a/src/tracer.h b/src/tracer.h index bcde291ee0..b01f652f80 100644 --- a/src/tracer.h +++ b/src/tracer.h @@ -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