summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/odebug.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/odebug.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/odebug.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libopie2/opiecore/odebug.h b/libopie2/opiecore/odebug.h
index 85941fd..a5c9ded 100644
--- a/libopie2/opiecore/odebug.h
+++ b/libopie2/opiecore/odebug.h
@@ -2,96 +2,99 @@
This file is part of the Opie Project
(C) 2003 Michael 'Mickey' Lauer (mickey@tm.informatik.uni-frankfurt.de)
Inspired by the KDE debug classes, which are
(C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
(C) 2002 Holger Freyther (freyther@kde.org)
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEBUG_H
#define ODEBUG_H
#include <qstring.h>
class QWidget;
class QDateTime;
class QDate;
class QTime;
class QPoint;
class QSize;
class QRect;
class QRegion;
class QStringList;
class QColor;
class QBrush;
+namespace Opie {
+namespace Core {
+
class odbgstream;
class ondbgstream;
#ifdef __GNUC__
#define o_funcinfo "[" << __PRETTY_FUNCTION__ << "] "
#else
#define o_funcinfo "[" << __FILE__ << ":" << __LINE__ << "] "
#endif
#define o_lineinfo "[" << __FILE__ << ":" << __LINE__ << "] "
#define owarn odWarning()
#define oerr odError()
#define odebug odDebug()
#define ofatal odFatal()
#define oendl "\n"
class odbgstreamprivate;
/**
* odbgstream is a text stream that allows you to print debug messages.
* Using the overloaded "<<" operator you can send messages. Usually
* you do not create the odbgstream yourself, but use @ref odDebug() (odebug)
* @ref odWarning() (owarn), @ref odError() (oerr) or @ref odFatal (ofatal) to obtain one.
*
* Example:
* <pre>
* int i = 5;
* odebug << "The value of i is " << i << oendl;
* </pre>
* @see odbgstream
*/
/*======================================================================================
* odbgstream
*======================================================================================*/
class odbgstream
{
public:
/**
* @internal
*/
odbgstream(unsigned int _area, unsigned int _level, bool _print = true);
odbgstream(const char * initialString, unsigned int _area, unsigned int _level, bool _print = true);
odbgstream(odbgstream &str);
odbgstream(const odbgstream &str);
virtual ~odbgstream();
@@ -349,126 +352,132 @@ class ondbgstream {
*/
ondbgstream &operator<<(const char *) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream& operator<<(const void *) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream& operator<<(void *) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream& operator<<(double) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream& operator<<(long) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream& operator<<(unsigned long) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream& operator << (QWidget*) { return *this; }
/**
* Does nothing.
* @return this stream
*/
ondbgstream &form(const char *, ...) { return *this; }
ondbgstream& operator<<( const QDateTime& ) { return *this; }
ondbgstream& operator<<( const QDate& ) { return *this; }
ondbgstream& operator<<( const QTime& ) { return *this; }
ondbgstream& operator<<( const QPoint & ) { return *this; }
ondbgstream& operator<<( const QSize & ) { return *this; }
ondbgstream& operator<<( const QRect & ) { return *this; }
ondbgstream& operator<<( const QRegion & ) { return *this; }
ondbgstream& operator<<( const QStringList & ) { return *this; }
ondbgstream& operator<<( const QColor & ) { return *this; }
ondbgstream& operator<<( const QBrush & ) { return *this; }
+
+private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* related functions
*======================================================================================*/
/**
* Does nothing.
* @param a stream
* @return the given @p s
*/
inline ondbgstream& endl( ondbgstream & s) { return s; }
/**
* Does nothing.
* @param a stream
* @return the given @p s
*/
inline ondbgstream& flush( ondbgstream & s) { return s; }
inline ondbgstream& perror( ondbgstream & s) { return s; }
/**
* Returns a debug stream. You can use it to print debug
* information.
* @param area an id to identify the output, 0 for default
*/
odbgstream odDebug(int area = 0);
odbgstream odDebug(bool cond, int area = 0);
/**
* Returns a backtrace.
* @param levels the number of levels (-1 for unlimited) of the backtrace
* @return a backtrace
*/
QString odBacktrace(int levels = -1);
/**
* Returns a dummy debug stream. The stream does not print anything.
* @param area an id to identify the output, 0 for default
* @see odDebug()
*/
inline ondbgstream ondDebug(int = 0) { return ondbgstream(); }
inline ondbgstream ondDebug(bool , int = 0) { return ondbgstream(); }
inline QString ondBacktrace() { return QString::null; }
inline QString ondBacktrace(int) { return QString::null; }
/**
* Returns a warning stream. You can use it to print warning
* information.
* @param area an id to identify the output, 0 for default
*/
odbgstream odWarning(int area = 0);
odbgstream odWarning(bool cond, int area = 0);
/**
* Returns an error stream. You can use it to print error
* information.
* @param area an id to identify the output, 0 for default
*/
odbgstream odError(int area = 0);
odbgstream odError(bool cond, int area = 0);
/**
* Returns a fatal error stream. You can use it to print fatal error
* information.
* @param area an id to identify the output, 0 for default
*/
odbgstream odFatal(int area = 0);
odbgstream odFatal(bool cond, int area = 0);
/**
* Deletes the odebugrc cache and therefore forces KDebug to reread the
* config file
*/
void odClearDebugConfig();
#ifdef OPIE_NO_DEBUG
#define odDebug ondDebug
#define odBacktrace ondBacktrace
#endif
#endif
+}
+}