X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftracer.h;h=62d26c54e48cdbcee59dab9d089b26b6f5a01551;hb=dd47a9eb1798d583dc84ec1c91c10cecbfa9874a;hp=365cfa53dd5e3a7f00007d17b52d9fd3aa5736a0;hpb=77e706c44175f3cf71473a42d5db890c77b3b7b3;p=lyx.git diff --git a/src/tracer.h b/src/tracer.h index 365cfa53dd..62d26c54e4 100644 --- a/src/tracer.h +++ b/src/tracer.h @@ -1,26 +1,49 @@ // -*- 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 #include "debug.h" #include "LString.h" -class DebugTracer { +/// +class Trace { public: - DebugTracer(string const & s) : str(s) { - lyxerr << string(depth, ' ') << "Trace begin : " + /// + explicit + 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