Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/io/qdebug.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5252#include <QtCore/qvector.h>
    5353#include <QtCore/qset.h>
     54
    5455
    5556QT_BEGIN_HEADER
     
    8081    inline ~QDebug() {
    8182        if (!--stream->ref) {
    82             if(stream->message_output)
    83                 qt_message_output(stream->type, stream->buffer.toLocal8Bit().data());
     83            if(stream->message_output) {
     84                QT_TRY {
     85                    qt_message_output(stream->type, stream->buffer.toLocal8Bit().data());
     86                } QT_CATCH(std::bad_alloc) { /* We're out of memory - give up. */ }
     87            }
    8488            delete stream;
    8589        }
    8690    }
    87     inline QDebug &space() { stream->space = true; stream->ts << " "; return *this; }
     91    inline QDebug &space() { stream->space = true; stream->ts << ; return *this; }
    8892    inline QDebug &nospace() { stream->space = false; return *this; }
    89     inline QDebug &maybeSpace() { if (stream->space) stream->ts << " "; return *this; }
    90 
    91     inline QDebug &operator<<(QChar t) { stream->ts << "\'" << t << "\'"; return maybeSpace(); }
    92     inline QDebug &operator<<(QBool t) { stream->ts << (bool(t) ? "true" : "false"); return maybeSpace(); }
     93    inline QDebug &maybeSpace() { if (stream->space) stream->ts << ; return *this; }
     94
     95    inline QDebug &operator<<(QChar t) { stream->ts << ; return maybeSpace(); }
     96    inline QDebug &operator<<(QBool t) { stream->ts << (bool(t) ? "true" : "false"); return maybeSpace(); }
    9397    inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }
    9498    inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
     
    106110    inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
    107111    inline QDebug &operator<<(const char* t) { stream->ts << QString::fromAscii(t); return maybeSpace(); }
    108     inline QDebug &operator<<(const QString & t) { stream->ts << "\"" << t  << "\""; return maybeSpace(); }
     112    inline QDebug &operator<<(const QString & t) { stream->ts << ; return maybeSpace(); }
    109113    inline QDebug &operator<<(const QStringRef & t) { return operator<<(t.toString()); }
    110     inline QDebug &operator<<(const QLatin1String &t) { stream->ts << "\""  << t.latin1() << "\""; return maybeSpace(); }
    111     inline QDebug &operator<<(const QByteArray & t) { stream->ts  << "\"" << t << "\""; return maybeSpace(); }
     114    inline QDebug &operator<<(const QLatin1String &t) { stream->ts << ; return maybeSpace(); }
     115    inline QDebug &operator<<(const QByteArray & t) { stream->ts  << ; return maybeSpace(); }
    112116    inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); }
    113117    inline QDebug &operator<<(QTextStreamFunction f) {
     
    159163#endif
    160164{
    161     debug.nospace() << "(";
     165    debug.nospace() << ;
    162166    for (Q_TYPENAME QList<T>::size_type i = 0; i < list.count(); ++i) {
    163167        if (i)
     
    165169        debug << list.at(i);
    166170    }
    167     debug << ")";
     171    debug << ;
    168172    return debug.space();
    169173}
     
    192196    for (typename QMap<aKey, aT>::const_iterator it = map.constBegin();
    193197         it != map.constEnd(); ++it) {
    194         debug << "(" << it.key() << ", " << it.value() << ")";
    195     }
    196     debug << ")";
     198        debug << ;
     199    }
     200    debug << ;
    197201    return debug.space();
    198202}
     
    209213    for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin();
    210214            it != hash.constEnd(); ++it)
    211         debug << "(" << it.key() << ", " << it.value() << ")";
    212     debug << ")";
     215        debug << ;
     216    debug << ;
    213217    return debug.space();
    214218}
     
    222226#endif
    223227{
    224     debug.nospace() << "QPair(" << pair.first << "," << pair.second << ")";
     228    debug.nospace() << "QPair(" << pair.first << ;
    225229    return debug.space();
    226230}
     
    231235    debug.nospace() << "QSet";
    232236    return operator<<(debug, set.toList());
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
    233255}
    234256
Note: See TracChangeset for help on using the changeset viewer.