Home · All Namespaces · All Classes · Main Classes |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Karoliina T. Salminen <karoliina.t.salminen@nokia.com> 00006 ** 00007 ** This file is part of duicontrolpanel. 00008 ** 00009 ** 00010 ** This library is free software; you can redistribute it and/or 00011 ** modify it under the terms of the GNU Lesser General Public 00012 ** License version 2.1 as published by the Free Software Foundation 00013 ** and appearing in the file LICENSE.LGPL included in the packaging 00014 ** of this file. 00015 ** 00016 ****************************************************************************/ 00017 00018 /* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */ 00019 /* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */ 00020 00021 /****************************************************************************** 00022 * The first part of the header can be loaded and loaded again, so we can turn 00023 * on and off the debug facility for each source file. 00024 */ 00025 00026 /* 00027 * Use these lines to disable the debug (or warning) messages in the entire 00028 * source tree. 00029 */ 00030 //#undef DEBUG 00031 //#undef WARNING 00032 00033 /* 00034 * Or use these lines to turn on all the debug (or warning) messages. 00035 */ 00036 //#define DEBUG 00037 #define WARNING 00038 00039 /* 00040 * If the debug facility is enabled we also enable all the warning messages. 00041 */ 00042 #if defined(DEBUG) && !defined(WARNING) 00043 # define WARNING 00044 #endif 00045 00046 #if defined(WARNING) && !defined(CRITICAL) 00047 # define CRITICAL 00048 #endif 00049 00050 /* 00051 * The DCP_DEBUG macro is used to print normal debug messages. 00052 */ 00053 #undef DCP_DEBUG 00054 #ifdef DEBUG 00055 # define DCP_DEBUG(...) DcpDebug::dcpPrintMsg (\ 00056 QtDebugMsg, \ 00057 __PRETTY_FUNCTION__, \ 00058 __VA_ARGS__) 00059 #else 00060 # define DCP_DEBUG(...) { /* Nothing... */ } 00061 #endif 00062 00063 /* 00064 * The DCP_WARNING is used to print warning messages. 00065 */ 00066 #undef DCP_WARNING 00067 #ifdef WARNING 00068 # define DCP_WARNING(...) DcpDebug::dcpPrintMsg (\ 00069 QtWarningMsg, \ 00070 __PRETTY_FUNCTION__, \ 00071 __VA_ARGS__) 00072 #else 00073 # define DCP_WARNING(...) { /* Nothing... */ } 00074 #endif 00075 00076 /* 00077 * The DCP_CRITICAL is used to print warning messages. 00078 */ 00079 #undef DCP_CRITICAL 00080 #ifdef CRITICAL 00081 # define DCP_CRITICAL(...) DcpDebug::dcpPrintMsg (\ 00082 QtCriticalMsg, \ 00083 __PRETTY_FUNCTION__, \ 00084 __VA_ARGS__) 00085 #else 00086 # define DCP_CRITICAL(...) { /* Nothing... */ } 00087 #endif 00088 00089 /****************************************************************************** 00090 * Here we have those parts that can be loaded only once, so we protect them 00091 * with DCPDEBUG_H. 00092 */ 00093 #ifndef DCPDEBUG_H 00094 #define DCPDEBUG_H 00095 00096 #include <QtDebug> 00097 00098 #define DCP_STR(qstring) qstring.toLatin1().constData() 00099 00100 namespace DcpDebug 00101 { 00103 void time(const QString& msg = ""); 00104 00108 void start(const QString& msg = ""); 00109 00113 void end(const QString& msg = ""); 00114 00118 void dcpMsg(QtMsgType type, const char *msg); 00119 00120 void dcpPrintMsg ( 00121 QtMsgType type, 00122 const char *function, 00123 const char *formatstring, 00124 ...); 00125 }; 00126 00129 #define DCP_FUNC_START DcpDebug::start(Q_FUNC_INFO); 00130 #define DCP_FUNC_END DcpDebug::end(Q_FUNC_INFO); 00131 00132 /* In debug mode this macro is a synonym for assert, 00133 * otherwise just outputs a waring message (as we are expected not to assert 00134 * in a release build */ 00135 #ifdef DEBUG 00136 00137 #define dcp_failfunc_unless(x, return_value...) \ 00138 Q_ASSERT (x) 00139 00140 #else // DEBUG 00141 00142 #define dcp_failfunc_unless(x, return_value...) \ 00143 if (!(x)) { \ 00144 qWarning (#x " is false at %s", Q_FUNC_INFO); \ 00145 return return_value; \ 00146 } 00147 00148 #endif // DEBUG 00149 00150 #endif // DCPDEBUG_H 00151
Copyright © 2009 Nokia Corporation | Generated on Tue Jul 5 2011 15:01:31 Doxygen 1.7.1 |
Meego control panel |