annotate base/Debug.h @ 900:dcfc40fc896e

Remove pch file
author Chris Cannam
date Sun, 27 Apr 2014 12:22:28 +0100
parents e802e550a1f2
children 0b15c9328003
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@685 22 #include <string>
Chris@685 23 #include <iostream>
Chris@685 24
Chris@685 25 class QString;
Chris@685 26 class QUrl;
Chris@685 27
Chris@685 28 QDebug &operator<<(QDebug &, const std::string &);
Chris@685 29 std::ostream &operator<<(std::ostream &, const QString &);
Chris@685 30 std::ostream &operator<<(std::ostream &, const QUrl &);
Chris@685 31
Chris@843 32 using std::cout;
Chris@843 33 using std::cerr;
Chris@843 34 using std::endl;
Chris@843 35
Chris@685 36 #ifndef NDEBUG
Chris@685 37
Chris@685 38 extern QDebug &getSVDebug();
Chris@685 39
Chris@690 40 #define SVDEBUG getSVDebug()
Chris@685 41
Chris@685 42 template <typename T>
Chris@685 43 inline QDebug &operator<<(QDebug &d, const T &t) {
Chris@685 44 QString s;
Chris@685 45 QTextStream ts(&s);
Chris@685 46 ts << t;
Chris@685 47 d << s;
Chris@685 48 return d;
Chris@685 49 }
Chris@685 50
Chris@685 51 #else
Chris@685 52
Chris@685 53 class NoDebug
Chris@685 54 {
Chris@685 55 public:
Chris@685 56 inline NoDebug() {}
Chris@685 57 inline ~NoDebug(){}
Chris@685 58
Chris@685 59 template <typename T>
Chris@685 60 inline NoDebug &operator<<(const T &) { return *this; }
Chris@685 61
Chris@685 62 inline NoDebug &operator<<(QTextStreamFunction) { return *this; }
Chris@685 63 };
Chris@685 64
Chris@690 65 #define SVDEBUG NoDebug()
Chris@685 66
Chris@685 67 #endif /* !NDEBUG */
Chris@685 68
Chris@685 69 #endif /* !_DEBUG_H_ */
Chris@685 70