| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kdebugclasses.h

    00001
    00002 /* This file is part of the KDE libraries
    00003     Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
    00004                   2000-2002 Stephan Kulow (coolo@kde.org)
    00005
    00006     This library is free software; you can redistribute it and/or
    00007     modify it under the terms of the GNU Library General Public
    00008     License as published by the Free Software Foundation; either
    00009     version 2 of the License, or (at your option) any later version.
    00010
    00011     This library is distributed in the hope that it will be useful,
    00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014     Library General Public License for more details.
    00015
    00016     You should have received a copy of the GNU Library General Public License
    00017     along with this library; see the file COPYING.LIB.  If not, write to
    00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019     Boston, MA 02111-1307, USA.
    00020 */
    00021
    00022 #ifndef _KDEBUG_CLASSES_H_
    00023 #define _KDEBUG_CLASSES_H_ "$Id: kdebugclasses.h,v 1.7 2002/07/04 13:22:50 coolo Exp $"
    00024
    00025 #include "kdebug.h"
    00026 #include <qpoint.h>
    00027 #include <qrect.h>
    00028 #include <qsize.h>
    00029 #include <qregion.h>
    00030 #include <qstringlist.h>
    00031 #include <qbrush.h>
    00032
    00033 #include "kurl.h"
    00034
    00035 inline kdbgstream operator<<( kdbgstream str, const QPoint & p )  { str << "(" << p.x() << ", " << p.y() << ")"; return str; }
    00036 inline kdbgstream operator<<( kdbgstream str, const QSize & s )  { str << "[" << s.width() << "x" << s.height() << "]"; return str; }
    00037 inline kdbgstream operator<<( kdbgstream str, const QRect & r )  { str << "[" << r.left() << ", " << r.top() << " - " << r.right() << ", " << r.bottom() << "]"; return str; }
    00038 inline kdbgstream operator<<( kdbgstream str, const QRegion & reg ) {
    00039   str = str.operator<<("[ ");
    00040   QMemArray<QRect>rs=reg.rects();
    00041   for (uint i=0;i<rs.size();++i)
    00042     str = str.operator<<( QString("[%1, %2 - %3, %4] ").arg(rs[i].left()).arg(rs[i].top()).arg(rs[i].right()).arg(rs[i].bottom()));
    00043   str = str.operator<<("]");
    00044   return str;
    00045 }
    00046
    00047 inline kdbgstream operator<<( kdbgstream str, const KURL & u )  { str << u.prettyURL(); return str; }
    00048
    00049 inline kdbgstream operator<<( kdbgstream str, const QStringList & l )  {
    00050   str = str.operator<<("(");
    00051   for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
    00052     str = str.operator<<( *it);
    00053     if (it != l.fromLast())
    00054       str = str.operator<<( ", ");
    00055   }
    00056   str = str.operator<<(")");
    00057   return str;
    00058 }
    00059 inline kdbgstream operator<<( kdbgstream str, const QColor &c )  {
    00060     if ( c.isValid() )
    00061         str = str.operator<<(c.name());
    00062     else
    00063         str = str.operator<<("(invalid/default)");
    00064     return str;
    00065 }
    00066 inline kdbgstream operator<<( kdbgstream str, const QBrush &b )  {
    00067     static const char* const s_brushStyles[] = {
    00068         "NoBrush", "SolidPattern", "Dense1Pattern", "Dense2Pattern", "Dense3Pattern",
    00069         "Dense4Pattern", "Dense5Pattern", "Dense6Pattern", "Dense7Pattern",
    00070         "HorPattern", "VerPattern", "CrossPattern", "BDiagPattern", "FDiagPattern",
    00071         "DiagCrossPattern" };
    00072     str = str.operator<<("[ style: ");
    00073     str = str.operator<<(s_brushStyles[ b.style() ]);
    00074     str = str.operator<<(" color: ");
    00075     // can't use operator<<(str, b.color()) because that terminates a kdbgstream (flushes)
    00076     if ( b.color().isValid() )
    00077         str = str.operator<<(b.color().name());
    00078     else
    00079         str = str.operator<<("(invalid/default)");
    00080     if ( b.pixmap() )
    00081         str = str.operator<<(" has a pixmap");
    00082     str = str.operator<<(" ]");
    00083     return str;
    00084 }
    00085
    00086 inline kndbgstream operator<<( kndbgstream str, const QPoint & )  { return str; }
    00087 inline kndbgstream operator<<( kndbgstream str, const QSize & )  { return str; }
    00088 inline kndbgstream operator<<( kndbgstream str, const QRect & )  { return str; }
    00089 inline kndbgstream operator<<( kndbgstream str, const QRegion & ) { return str; }
    00090 inline kndbgstream operator<<( kndbgstream str, const KURL & )  { return str; }
    00091 inline kndbgstream operator<<( kndbgstream str, const QStringList & ) { return str; }
    00092 inline kndbgstream operator<<( kndbgstream str, const QColor & ) { return str; }
    00093 inline kndbgstream operator<<( kndbgstream str, const QBrush & ) { return str; }
    00094
    00095 #endif
    00096

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001