Logo Search packages:      
Sourcecode: kmess version File versions

kmessdebug.h

/***************************************************************************
                          kmessdebug.h  -  description
                             -------------------
    begin                : Sun Jan 5 2003
    copyright            : (C) 2003 by Mike K. Bennett
    email                : mkb137b@hotmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KMESSDEBUG_H
#define KMESSDEBUG_H

#ifdef HAVE_CONFIG_H
 #include "config.h"
#endif

// Since all debugging code uses kdDebug(), this is also a good
// reason to include this file by default so no one else has to.
#include <kdebug.h>

#if ( KMESS_DEBUG == 1)
  #define KMESSTEST
  #define KMESS_NETWORK_WINDOW

  #define KMESSDEBUG_KMESS
  #define KMESSDEBUG_KMESSINTERFACE
  #define KMESSDEBUG_KMESSVIEW
  #define KMESSDEBUG_KMESSVIEWINTERFACE
  #define KMESSDEBUG_KMESSLISTVIEWITEM
  #define KMESSDEBUG_CONTACTLISTVIEWITEM
  #define KMESSDEBUG_GROUPLISTVIEWITEM
  #define KMESSDEBUG_INITIALVIEW
  #define KMESSDEBUG_CONNECTION

  #define KMESSDEBUG_NOTIFICATION
  #define KMESSDEBUG_CHALLENGEHANDLER
  #define KMESSDEBUG_SWITCHBOARD
  #define KMESSDEBUG_SERVERMESSAGES
  #define KMESSDEBUG_SSLLOGINHANDLER
  #define KMESSDEBUG_MSNFTP
  #define KMESSDEBUG_DIRECTCONNECTION
  #define KMESSDEBUG_TCPCONNECTION
  #define KMESSDEBUG_OFFLINE_IM

  #define KMESSDEBUG_ACCOUNT

  #define KMESSDEBUG_CURRENTACCOUNT
  #define KMESSDEBUG_CONTACT
  #define KMESSDEBUG_CONTACTEXTENSION
  #define KMESSDEBUG_CONTACTLIST
  #define KMESSDEBUG_GROUP
  #define KMESSDEBUG_GROUPLIST
  #define KMESSDEBUG_SETTINGSDIALOG
  #define KMESSDEBUG_CHATMASTER
  #define KMESSDEBUG_CHATWINDOW
  #define KMESSDEBUG_CHATVIEW
  #define KMESSDEBUG_CHATMESSAGEVIEW
  #define KMESSDEBUG_CONTACTSIDEBAR
  #define KMESSDEBUG_CONTACTFRAME
  #define KMESSDEBUG_CONTACTACTION
  #define KMESSDEBUG_INVITEDCONTACT
  #define KMESSDEBUG_XSLTRANSFORMATION
  #define KMESSDEBUG_IDLETIMER
  #define KMESSDEBUG_POPUPNOTIFICATION
  #define KMESSDEBUG_CONTACTOFFLINENOTIFICATION
  #define KMESSDEBUG_CONTACTONLINENOTIFICATION
  #define KMESSDEBUG_EMAILNOTIFICATION
  #define KMESSDEBUG_CHATNOTIFICATION
  #define KMESSDEBUG_EMOTICONS
  #define KMESSDEBUG_NOWLISTENINGCLIENT
  #define KMESSDEBUG_THUMBNAILPROVIDER

  #define KMESSDEBUG_MIMEMESSAGE
  #define KMESSDEBUG_APPLICATION
  #define KMESSDEBUG_APPLICATIONLIST
  #define KMESSDEBUG_MIMEAPPLICATION
  #define KMESSDEBUG_P2PAPPLICATION
  #define KMESSDEBUG_FILETRANSFER_P2P
  #define KMESSDEBUG_PICTURETRANSFER_P2P
  #define KMESSDEBUG_FILETRANSFER
  #define KMESSDEBUG_REMOTEDESKTOP
  #define KMESSDEBUG_TRANSFERPROGRESS
  #define KMESSDEBUG_WEBAPPLICATION_P2P

  #define KMESSDEBUG_UPNP
  #define KMESSDEBUG_SOAPMESSAGE
  #define KMESSDEBUG_HTTPSOAPCONNECTION
  #define KMESSDEBUG_APPDIRECTORYCONNECTION

  #define KMESSDEBUG_CONTACTPROPERTIES

#endif


// k_funcinfo in c-string style.
#ifdef __GNUC__
#define c_funcinfo __PRETTY_FUNCTION__
#else
#define c_funcinfo "<unknown>"
#endif


// Debug macro to warn for null pointers
#ifdef KMESSTEST
  // Warns that a pointer was null, full debug version
  bool _kmessWarnNull(bool isNull, const char *var, const char *funcinfo, const char *file, int line);

  // Wrapper macro for warn-if-null methods.
  // This idea was taken from Q_ASSERT (qglobal.h).
  // silent version:  #define KMESS_NULL(x) (x != 0)
  #define KMESS_NULL(x) (x == 0 && _kmessWarnNull(x == 0, #x, c_funcinfo, __FILE__, __LINE__))
#else
  // Warns that a pointer was null
  bool _kmessWarnNull(bool isNull, const char *var, const char *funcinfo);

  #define KMESS_NULL(x) (x == 0 && _kmessWarnNull(x == 0, #x, c_funcinfo))
#endif


// Debug macro to add messages to the network window
#ifdef KMESS_NETWORK_WINDOW
  class QObject;

  // Inform the network window the connection was closed
  void _kmessNetClose(QObject *connection);

  // Inform the network window about a new connection
  void _kmessNetInit(QObject *connection, const QString &title);

  // Add the received data to the network window
  void _kmessNetReceived(QObject *connection, const QByteArray &message);

  // Add the sent data to the network window
  void _kmessNetSent(QObject *connection, const QByteArray &message);

  // Wrapper macro, call network window when it's compiled
  #define KMESS_NET_CLOSE(c)      (_kmessNetClose(c))
  #define KMESS_NET_INIT(c,t)     (_kmessNetInit(c, t))
  #define KMESS_NET_RECEIVED(c,d) (_kmessNetReceived(c, d))
  #define KMESS_NET_SENT(c,d)     (_kmessNetSent(c, d))
#else
  #define KMESS_NET_CLOSE(c)
  #define KMESS_NET_INIT(c,t)
  #define KMESS_NET_RECEIEVED(c,d)
  #define KMESS_NET_SENT(c,d)
#endif


#endif  // KMESSDEBUG_H

Generated by  Doxygen 1.6.0   Back to index