reportdebug.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           reportdebug.h
00003                              -------------------
00004     begin                : Sat May 22 2004
00005     copyright            : (C) 2004-2005 by Ace Jones
00006     email                : <ace.j@hotpop.com>
00007                            Thomas Baumgart <ipwizard@users.sourceforge.net>
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef REPORTDEBUG_H
00020 #define REPORTDEBUG_H
00021 
00022 // ----------------------------------------------------------------------------
00023 // QT Includes
00024 
00025 // ----------------------------------------------------------------------------
00026 // KDE Includes
00027 
00028 // ----------------------------------------------------------------------------
00029 // Project Includes
00030 
00031 namespace reports {
00032 
00033 // define to enable massive debug logging to stderr
00034 #undef DEBUG_REPORTS
00035 // #define DEBUG_REPORTS
00036 
00037 #define DEBUG_ENABLED_BY_DEFAULT false
00038 
00039 #ifdef DEBUG_REPORTS
00040 
00041 // define to filter out account names & transaction amounts
00042 // DO NOT check into CVS with this defined!! It breaks all
00043 // unit tests.
00044 #undef DEBUG_HIDE_SENSITIVE
00045 
00046 #define DEBUG_ENTER(x) Debug ___DEBUG(x)
00047 #define DEBUG_OUTPUT(x) ___DEBUG.output(x)
00048 #define DEBUG_OUTPUT_IF(x,y) { if (x) ___DEBUG.output(y); }
00049 #define DEBUG_ENABLE(x) Debug::enable(x)
00050 #define DEBUG_ENABLE_KEY(x) Debug::setEnableKey(x)
00051 #ifdef DEBUG_HIDE_SENSITIVE
00052 #define DEBUG_SENSITIVE(x) QString("hidden")
00053 #else
00054 #define DEBUG_SENSITIVE(x) (x)
00055 #endif
00056 
00057 #else
00058 
00059 #define DEBUG_ENTER(x)
00060 #define DEBUG_OUTPUT(x)
00061 #define DEBUG_OUTPUT_IF(x,y)
00062 #define DEBUG_ENABLE(x)
00063 #define DEBUG_SENSITIVE(x)
00064 #endif
00065 
00066 class Debug
00067 {
00068   QString m_methodName;
00069   static QString m_sTabs;
00070   static bool m_sEnabled;
00071   bool m_enabled;
00072   static QString m_sEnableKey;
00073 public:
00074   Debug( const QString& _name );
00075   ~Debug();
00076   void output( const QString& _text );
00077   static void enable( bool _e ) { m_sEnabled = _e; }
00078   static void setEnableKey( const QString& _s ) { m_sEnableKey = _s; }
00079 };
00080 
00081 } // end namespace reports
00082 
00083 #endif // REPORTDEBUG_H

Generated on Wed Jan 26 13:03:18 2011 for KMyMoney by  doxygen 1.5.6