diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-07-25 10:04:58 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-18 06:15:14 +0200 |
commit | 3d3c5dc44e28f1e9cfef12f6ccb881a3c0060c7a (patch) | |
tree | 74db688d9949151e8c8d7a778eaadb3c1d2de13a /src | |
parent | 24bc6342cae364ad5d1e74497d64c569916eaf48 (diff) |
QMessageLogger: make member functions const
Just because we can :)
It looks a bit weird that QMessageLogger has a constexpr
constructor, but no const methods...
Change-Id: I794dd2b3326c45be17b29decb47c9cac4778d397
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 16 | ||||
-rw-r--r-- | src/corelib/global/qlogging.h | 18 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 4fd421c36f..ba785e26f4 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -182,7 +182,7 @@ static void qt_message(QtMsgType msgType, const QMessageLogContext &context, con \sa qDebug() */ -void QMessageLogger::debug(const char *msg, ...) +void QMessageLogger::debug(const char *msg, ...) const { va_list ap; va_start(ap, msg); // use variable arg list @@ -197,7 +197,7 @@ void QMessageLogger::debug(const char *msg, ...) \sa qDebug(), QDebug */ -QDebug QMessageLogger::debug() +QDebug QMessageLogger::debug() const { QDebug dbg = QDebug(QtDebugMsg); QMessageLogContext &ctxt = dbg.stream->context; @@ -212,7 +212,7 @@ QDebug QMessageLogger::debug() \sa QNoDebug, qDebug() */ -QNoDebug QMessageLogger::noDebug() +QNoDebug QMessageLogger::noDebug() const { return QNoDebug(); } @@ -226,7 +226,7 @@ QNoDebug QMessageLogger::noDebug() \sa qWarning() */ -void QMessageLogger::warning(const char *msg, ...) +void QMessageLogger::warning(const char *msg, ...) const { va_list ap; va_start(ap, msg); // use variable arg list @@ -240,7 +240,7 @@ void QMessageLogger::warning(const char *msg, ...) \sa qWarning(), QDebug */ -QDebug QMessageLogger::warning() +QDebug QMessageLogger::warning() const { QDebug dbg = QDebug(QtWarningMsg); QMessageLogContext &ctxt = dbg.stream->context; @@ -257,7 +257,7 @@ QDebug QMessageLogger::warning() \sa qCritical() */ -void QMessageLogger::critical(const char *msg, ...) +void QMessageLogger::critical(const char *msg, ...) const { va_list ap; va_start(ap, msg); // use variable arg list @@ -271,7 +271,7 @@ void QMessageLogger::critical(const char *msg, ...) \sa qCritical(), QDebug */ -QDebug QMessageLogger::critical() +QDebug QMessageLogger::critical() const { QDebug dbg = QDebug(QtCriticalMsg); QMessageLogContext &ctxt = dbg.stream->context; @@ -287,7 +287,7 @@ QDebug QMessageLogger::critical() \sa qFatal() */ -void QMessageLogger::fatal(const char *msg, ...) Q_DECL_NOTHROW +void QMessageLogger::fatal(const char *msg, ...) const Q_DECL_NOTHROW { va_list ap; va_start(ap, msg); // use variable arg list diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index f1f9643753..fe0a7df79a 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -93,22 +93,22 @@ public: Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function, const char *category) : context(file, line, function, category) {} - void debug(const char *msg, ...) + void debug(const char *msg, ...) const #if defined(Q_CC_GNU) && !defined(__INSURE__) __attribute__ ((format (printf, 2, 3))) #endif ; - void noDebug(const char *, ...) + void noDebug(const char *, ...) const #if defined(Q_CC_GNU) && !defined(__INSURE__) __attribute__ ((format (printf, 2, 3))) #endif {} - void warning(const char *msg, ...) + void warning(const char *msg, ...) const #if defined(Q_CC_GNU) && !defined(__INSURE__) __attribute__ ((format (printf, 2, 3))) #endif ; - void critical(const char *msg, ...) + void critical(const char *msg, ...) const #if defined(Q_CC_GNU) && !defined(__INSURE__) __attribute__ ((format (printf, 2, 3))) #endif @@ -117,18 +117,18 @@ public: #ifndef Q_CC_MSVC Q_NORETURN #endif - void fatal(const char *msg, ...) Q_DECL_NOTHROW + void fatal(const char *msg, ...) const Q_DECL_NOTHROW #if defined(Q_CC_GNU) && !defined(__INSURE__) __attribute__ ((format (printf, 2, 3))) #endif ; #ifndef QT_NO_DEBUG_STREAM - QDebug debug(); - QDebug warning(); - QDebug critical(); + QDebug debug() const; + QDebug warning() const; + QDebug critical() const; - QNoDebug noDebug(); + QNoDebug noDebug() const; #endif // QT_NO_DEBUG_STREAM private: |