mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
676e29b916
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1218 a592a061-630c-0410-9148-cb99ea01b6c8
54 lines
1010 B
C++
54 lines
1010 B
C++
// -*- 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"
|
|
|
|
///
|
|
class Trace {
|
|
public:
|
|
///
|
|
explicit
|
|
Trace(string const & s) : str(s) {
|
|
lyxerr << string(depth, ' ') << "TRACE IN: "
|
|
<< str << std::endl;
|
|
depth += 2;
|
|
|
|
}
|
|
///
|
|
~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
|