annotate debug.h @ 311:4811eb34e819 new-branches-with-status-outside-tabs

Add Start New Branch and Cancel New Branch to uncommitted item menu; add branch name to Commit dialog
author Chris Cannam
date Tue, 01 Mar 2011 14:22:29 +0000
parents 8fd71f570884
children
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@244 8 Copyright (c) 2011 Chris Cannam
Chris@244 9 Copyright (c) 2011 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
Chris@57 17
Chris@57 18 #ifndef _DEBUG_H_
Chris@57 19 #define _DEBUG_H_
Chris@57 20
Chris@57 21 #include <QDebug>
Chris@57 22 #include <QTextStream>
Chris@57 23 #include <string>
Chris@57 24 #include <iostream>
Chris@57 25
Chris@57 26 class QString;
Chris@57 27 class QUrl;
Chris@57 28
Chris@57 29 QDebug &operator<<(QDebug &, const std::string &);
Chris@57 30 std::ostream &operator<<(std::ostream &, const QString &);
Chris@57 31 std::ostream &operator<<(std::ostream &, const QUrl &);
Chris@57 32
Chris@57 33 #ifndef NDEBUG
Chris@57 34
Chris@57 35 extern QDebug &getEasyHgDebug();
Chris@57 36
Chris@57 37 #define DEBUG getEasyHgDebug()
Chris@57 38
Chris@57 39 template <typename T>
Chris@57 40 inline QDebug &operator<<(QDebug &d, const T &t) {
Chris@57 41 QString s;
Chris@57 42 QTextStream ts(&s);
Chris@57 43 ts << t;
Chris@57 44 d << s;
Chris@57 45 return d;
Chris@57 46 }
Chris@57 47
Chris@57 48 #else
Chris@57 49
Chris@57 50 class NoDebug
Chris@57 51 {
Chris@57 52 public:
Chris@57 53 inline NoDebug() {}
Chris@57 54 inline ~NoDebug(){}
Chris@57 55
Chris@57 56 template <typename T>
Chris@57 57 inline NoDebug &operator<<(const T &) { return *this; }
Chris@57 58
Chris@57 59 inline NoDebug &operator<<(QTextStreamFunction) { return *this; }
Chris@57 60 };
Chris@57 61
Chris@57 62 #define DEBUG NoDebug()
Chris@57 63
Chris@57 64 #endif /* !NDEBUG */
Chris@57 65
Chris@57 66 #endif /* !_DEBUG_H_ */
Chris@57 67