[Telepathy-commits] [telepathy-qt4/master] Add debug.hpp for library internal debugging output
Olli Salli
olli.salli at collabora.co.uk
Mon Aug 25 13:12:04 PDT 2008
---
TelepathyQt4/Makefile.am | 1 +
TelepathyQt4/debug.hpp | 84 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+), 0 deletions(-)
create mode 100644 TelepathyQt4/debug.hpp
diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index 6944f08..68e9a03 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -36,6 +36,7 @@ libtelepathy_qt4_la_SOURCES = \
cli-media-session-handler.cpp \
cli-media-stream-handler.cpp \
cli-properties.cpp \
+ debug.hpp \
types.cpp \
header-compile-test.cpp
diff --git a/TelepathyQt4/debug.hpp b/TelepathyQt4/debug.hpp
new file mode 100644
index 0000000..9e11945
--- /dev/null
+++ b/TelepathyQt4/debug.hpp
@@ -0,0 +1,84 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt4_debug_HEADER_GUARD_
+#define _TelepathyQt4_debug_HEADER_GUARD_
+
+#include <config.h>
+
+namespace Telepathy
+{
+
+#ifdef ENABLE_DEBUG
+
+#include <QDebug>
+
+inline QDebug debug()
+{
+ return qDebug() << PACKAGE_NAME " (version " PACKAGE_VERSION ") DEBUG:";
+}
+
+inline QDebug warning()
+{
+ return qWarning() << PACKAGE_NAME " (version " PACKAGE_VERSION ") WARNING:";
+}
+
+#else /* #ifdef ENABLE_DEBUG */
+
+struct NoDebug
+{
+ template <typename T>
+ NoDebug& operator<<(const T&)
+ {
+ return *this;
+ }
+
+ NoDebug& space()
+ {
+ return *this;
+ }
+
+ NoDebug& noSpace()
+ {
+ return *this;
+ }
+
+ NoDebug& maybeSpace()
+ {
+ return *this;
+ }
+};
+
+inline NoDebug debug()
+{
+ return NoDebug();
+}
+
+inline NoDebug warning()
+{
+ return NoDebug();
+}
+
+#endif /* #ifdef ENABLE_DEBUG */
+
+} /* namespace Telepathy */
+
+#endif
--
1.5.6.3
More information about the Telepathy-commits
mailing list