Mercurial > hg > svcore
annotate base/Debug.h @ 1060:57633d605547 tonioni
Add data export options (not all implemented yet)
author | Chris Cannam |
---|---|
date | Mon, 30 Mar 2015 17:27:25 +0100 |
parents | 16dc7307d43a |
children | c1e43c8d2527 |
rev | line source |
---|---|
Chris@685 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@685 | 2 |
Chris@685 | 3 /* |
Chris@685 | 4 Sonic Visualiser |
Chris@685 | 5 An audio file viewer and annotation editor. |
Chris@685 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@685 | 7 This file copyright 2010-2011 Chris Cannam and QMUL. |
Chris@685 | 8 |
Chris@685 | 9 This program is free software; you can redistribute it and/or |
Chris@685 | 10 modify it under the terms of the GNU General Public License as |
Chris@685 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@685 | 12 License, or (at your option) any later version. See the file |
Chris@685 | 13 COPYING included with this distribution for more information. |
Chris@685 | 14 */ |
Chris@685 | 15 |
Chris@685 | 16 #ifndef _DEBUG_H_ |
Chris@685 | 17 #define _DEBUG_H_ |
Chris@685 | 18 |
Chris@685 | 19 #include <QDebug> |
Chris@685 | 20 #include <QTextStream> |
Chris@843 | 21 |
Chris@1042 | 22 #include "RealTime.h" |
Chris@871 | 23 |
Chris@685 | 24 #include <string> |
Chris@685 | 25 #include <iostream> |
Chris@685 | 26 |
Chris@685 | 27 class QString; |
Chris@685 | 28 class QUrl; |
Chris@685 | 29 |
Chris@685 | 30 QDebug &operator<<(QDebug &, const std::string &); |
Chris@685 | 31 std::ostream &operator<<(std::ostream &, const QString &); |
Chris@685 | 32 std::ostream &operator<<(std::ostream &, const QUrl &); |
Chris@685 | 33 |
Chris@843 | 34 using std::cout; |
Chris@843 | 35 using std::cerr; |
Chris@843 | 36 using std::endl; |
Chris@843 | 37 |
Chris@685 | 38 #ifndef NDEBUG |
Chris@685 | 39 |
Chris@685 | 40 extern QDebug &getSVDebug(); |
Chris@685 | 41 |
Chris@690 | 42 #define SVDEBUG getSVDebug() |
Chris@685 | 43 |
Chris@1042 | 44 inline QDebug &operator<<(QDebug &d, const RealTime &rt) { |
Chris@1042 | 45 d << rt.toString(); |
Chris@1042 | 46 return d; |
Chris@1042 | 47 } |
Chris@1042 | 48 |
Chris@871 | 49 inline QDebug &operator<<(QDebug &d, const Vamp::RealTime &rt) { |
Chris@871 | 50 d << rt.toString(); |
Chris@871 | 51 return d; |
Chris@871 | 52 } |
Chris@871 | 53 |
Chris@685 | 54 template <typename T> |
Chris@685 | 55 inline QDebug &operator<<(QDebug &d, const T &t) { |
Chris@685 | 56 QString s; |
Chris@685 | 57 QTextStream ts(&s); |
Chris@685 | 58 ts << t; |
Chris@685 | 59 d << s; |
Chris@685 | 60 return d; |
Chris@685 | 61 } |
Chris@685 | 62 |
Chris@685 | 63 #else |
Chris@685 | 64 |
Chris@685 | 65 class NoDebug |
Chris@685 | 66 { |
Chris@685 | 67 public: |
Chris@685 | 68 inline NoDebug() {} |
Chris@685 | 69 inline ~NoDebug(){} |
Chris@685 | 70 |
Chris@685 | 71 template <typename T> |
Chris@685 | 72 inline NoDebug &operator<<(const T &) { return *this; } |
Chris@685 | 73 |
Chris@685 | 74 inline NoDebug &operator<<(QTextStreamFunction) { return *this; } |
Chris@685 | 75 }; |
Chris@685 | 76 |
Chris@690 | 77 #define SVDEBUG NoDebug() |
Chris@685 | 78 |
Chris@685 | 79 #endif /* !NDEBUG */ |
Chris@685 | 80 |
Chris@685 | 81 #endif /* !_DEBUG_H_ */ |
Chris@685 | 82 |