2000-03-28 02:18:55 +00:00
|
|
|
// -*- C++ -*-
|
2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
2000-03-17 10:26:26 +00:00
|
|
|
#ifndef TRACER_H
|
|
|
|
#define TRACER_H
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-03-17 10:26:26 +00:00
|
|
|
#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;
|
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
|