2000-03-28 02:18:55 +00:00
|
|
|
// -*- C++ -*-
|
2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
2000-07-24 13:53:19 +00:00
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2000-07-24 13:53:19 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2000-07-24 13:53:19 +00:00
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
2000-03-17 10:26:26 +00:00
|
|
|
#ifndef TRACER_H
|
|
|
|
#define TRACER_H
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "LString.h"
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-11-15 03:22:08 +00:00
|
|
|
class Trace {
|
2000-03-17 10:26:26 +00:00
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
2000-11-15 03:22:08 +00:00
|
|
|
Trace(string const & s) : str(s) {
|
|
|
|
lyxerr << string(depth, ' ') << "TRACE IN: "
|
2000-04-04 00:19:15 +00:00
|
|
|
<< str << std::endl;
|
2000-11-15 03:22:08 +00:00
|
|
|
depth += 2;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-03-17 10:26:26 +00:00
|
|
|
}
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-11-15 03:22:08 +00:00
|
|
|
~Trace() {
|
|
|
|
depth -= 2;
|
|
|
|
lyxerr << string(depth, ' ') << "TRACE OUT: "
|
2000-04-04 00:19:15 +00:00
|
|
|
<< str << std::endl;
|
2000-03-17 10:26:26 +00:00
|
|
|
}
|
|
|
|
private:
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-03-17 10:26:26 +00:00
|
|
|
string str;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-03-17 10:26:26 +00:00
|
|
|
static int depth;
|
|
|
|
};
|
|
|
|
|
2000-11-15 03:22:08 +00:00
|
|
|
// 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
|
2000-03-17 10:26:26 +00:00
|
|
|
#endif
|