Chris@685: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@685: Chris@685: /* Chris@685: Sonic Visualiser Chris@685: An audio file viewer and annotation editor. Chris@685: Centre for Digital Music, Queen Mary, University of London. Chris@685: This file copyright 2010-2011 Chris Cannam and QMUL. Chris@685: Chris@685: This program is free software; you can redistribute it and/or Chris@685: modify it under the terms of the GNU General Public License as Chris@685: published by the Free Software Foundation; either version 2 of the Chris@685: License, or (at your option) any later version. See the file Chris@685: COPYING included with this distribution for more information. Chris@685: */ Chris@685: Chris@685: #ifndef _DEBUG_H_ Chris@685: #define _DEBUG_H_ Chris@685: Chris@685: #include Chris@685: #include Chris@843: Chris@871: #include Chris@871: Chris@685: #include Chris@685: #include Chris@685: Chris@685: class QString; Chris@685: class QUrl; Chris@685: Chris@685: QDebug &operator<<(QDebug &, const std::string &); Chris@685: std::ostream &operator<<(std::ostream &, const QString &); Chris@685: std::ostream &operator<<(std::ostream &, const QUrl &); Chris@685: Chris@843: using std::cout; Chris@843: using std::cerr; Chris@843: using std::endl; Chris@843: Chris@685: #ifndef NDEBUG Chris@685: Chris@685: extern QDebug &getSVDebug(); Chris@685: Chris@690: #define SVDEBUG getSVDebug() Chris@685: Chris@871: inline QDebug &operator<<(QDebug &d, const Vamp::RealTime &rt) { Chris@871: d << rt.toString(); Chris@871: return d; Chris@871: } Chris@871: Chris@685: template Chris@685: inline QDebug &operator<<(QDebug &d, const T &t) { Chris@685: QString s; Chris@685: QTextStream ts(&s); Chris@685: ts << t; Chris@685: d << s; Chris@685: return d; Chris@685: } Chris@685: Chris@685: #else Chris@685: Chris@685: class NoDebug Chris@685: { Chris@685: public: Chris@685: inline NoDebug() {} Chris@685: inline ~NoDebug(){} Chris@685: Chris@685: template Chris@685: inline NoDebug &operator<<(const T &) { return *this; } Chris@685: Chris@685: inline NoDebug &operator<<(QTextStreamFunction) { return *this; } Chris@685: }; Chris@685: Chris@690: #define SVDEBUG NoDebug() Chris@685: Chris@685: #endif /* !NDEBUG */ Chris@685: Chris@685: #endif /* !_DEBUG_H_ */ Chris@685: