LCOV - code coverage report
Current view: top level - usr/include/x86_64-linux-gnu/qt5/QtCore - qlogging.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 6 0.0 %
Date: 2016-11-29 15:07:43 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /****************************************************************************
       2             : **
       3             : ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
       4             : ** Contact: http://www.qt-project.org/legal
       5             : **
       6             : ** This file is part of the QtCore module of the Qt Toolkit.
       7             : **
       8             : ** $QT_BEGIN_LICENSE:LGPL$
       9             : ** Commercial License Usage
      10             : ** Licensees holding valid commercial Qt licenses may use this file in
      11             : ** accordance with the commercial license agreement provided with the
      12             : ** Software or, alternatively, in accordance with the terms contained in
      13             : ** a written agreement between you and Digia.  For licensing terms and
      14             : ** conditions see http://qt.digia.com/licensing.  For further information
      15             : ** use the contact form at http://qt.digia.com/contact-us.
      16             : **
      17             : ** GNU Lesser General Public License Usage
      18             : ** Alternatively, this file may be used under the terms of the GNU Lesser
      19             : ** General Public License version 2.1 as published by the Free Software
      20             : ** Foundation and appearing in the file LICENSE.LGPL included in the
      21             : ** packaging of this file.  Please review the following information to
      22             : ** ensure the GNU Lesser General Public License version 2.1 requirements
      23             : ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
      24             : **
      25             : ** In addition, as a special exception, Digia gives you certain additional
      26             : ** rights.  These rights are described in the Digia Qt LGPL Exception
      27             : ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
      28             : **
      29             : ** GNU General Public License Usage
      30             : ** Alternatively, this file may be used under the terms of the GNU
      31             : ** General Public License version 3.0 as published by the Free Software
      32             : ** Foundation and appearing in the file LICENSE.GPL included in the
      33             : ** packaging of this file.  Please review the following information to
      34             : ** ensure the GNU General Public License version 3.0 requirements will be
      35             : ** met: http://www.gnu.org/copyleft/gpl.html.
      36             : **
      37             : **
      38             : ** $QT_END_LICENSE$
      39             : **
      40             : ****************************************************************************/
      41             : 
      42             : #include <QtCore/qglobal.h>
      43             : 
      44             : #ifndef QLOGGING_H
      45             : #define QLOGGING_H
      46             : 
      47             : #if 0
      48             : // header is automatically included in qglobal.h
      49             : #pragma qt_no_master_include
      50             : #endif
      51             : 
      52             : QT_BEGIN_NAMESPACE
      53             : 
      54             : /*
      55             :   Forward declarations only.
      56             : 
      57             :   In order to use the qDebug() stream, you must #include<QDebug>
      58             : */
      59             : class QDebug;
      60             : class QNoDebug;
      61             : 
      62             : enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg };
      63             : 
      64             : class QMessageLogContext
      65             : {
      66             :     Q_DISABLE_COPY(QMessageLogContext)
      67             : public:
      68             :     Q_DECL_CONSTEXPR QMessageLogContext() : version(1), line(0), file(0), function(0), category(0) {}
      69           0 :     Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName)
      70           0 :         : version(1), line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
      71             : 
      72             :     void copy(const QMessageLogContext &logContext);
      73             : 
      74             :     int version;
      75             :     int line;
      76             :     const char *file;
      77             :     const char *function;
      78             :     const char *category;
      79             : 
      80             : private:
      81             :     friend class QMessageLogger;
      82             :     friend class QDebug;
      83             : };
      84             : 
      85             : class QLoggingCategory;
      86             : 
      87             : class Q_CORE_EXPORT QMessageLogger
      88             : {
      89             :     Q_DISABLE_COPY(QMessageLogger)
      90             : public:
      91             :     Q_DECL_CONSTEXPR QMessageLogger() : context() {}
      92           0 :     Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function)
      93           0 :         : context(file, line, function, "default") {}
      94           0 :     Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function, const char *category)
      95           0 :         : context(file, line, function, category) {}
      96             : 
      97             :     void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      98             :     void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3)
      99             :     {}
     100             :     void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
     101             :     void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
     102             : 
     103             :     typedef const QLoggingCategory &(*CategoryFunction)();
     104             : 
     105             :     void debug(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
     106             :     void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
     107             :     void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
     108             :     void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
     109             :     void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
     110             :     void critical(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
     111             : 
     112             : #ifndef Q_CC_MSVC
     113             :     Q_NORETURN
     114             : #endif
     115             :     void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
     116             : 
     117             : #ifndef QT_NO_DEBUG_STREAM
     118             :     QDebug debug() const;
     119             :     QDebug debug(const QLoggingCategory &cat) const;
     120             :     QDebug debug(CategoryFunction catFunc) const;
     121             :     QDebug warning() const;
     122             :     QDebug warning(const QLoggingCategory &cat) const;
     123             :     QDebug warning(CategoryFunction catFunc) const;
     124             :     QDebug critical() const;
     125             :     QDebug critical(const QLoggingCategory &cat) const;
     126             :     QDebug critical(CategoryFunction catFunc) const;
     127             : 
     128             :     QNoDebug noDebug() const Q_DECL_NOTHROW;
     129             : #endif // QT_NO_DEBUG_STREAM
     130             : 
     131             : private:
     132             :     QMessageLogContext context;
     133             : };
     134             : 
     135             : /*
     136             :   qDebug, qWarning, qCritical, qFatal are redefined to automatically include context information
     137             :  */
     138             : #define qDebug QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug
     139             : #define qWarning QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).warning
     140             : #define qCritical QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).critical
     141             : #define qFatal QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).fatal
     142             : 
     143             : #define QT_NO_QDEBUG_MACRO while (false) QMessageLogger().noDebug
     144             : #define QT_NO_QWARNING_MACRO while (false) QMessageLogger().noDebug
     145             : 
     146             : #if defined(QT_NO_DEBUG_OUTPUT)
     147             : #  undef qDebug
     148             : #  define qDebug QT_NO_QDEBUG_MACRO
     149             : #endif
     150             : #if defined(QT_NO_WARNING_OUTPUT)
     151             : #  undef qWarning
     152             : #  define qWarning QT_NO_QWARNING_MACRO
     153             : #endif
     154             : 
     155             : Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context,
     156             :                                      const QString &message);
     157             : 
     158             : Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
     159             : Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
     160             : 
     161             : #if QT_DEPRECATED_SINCE(5, 0)// deprecated. Use qInstallMessageHandler instead!
     162             : typedef void (*QtMsgHandler)(QtMsgType, const char *);
     163             : Q_CORE_EXPORT QT_DEPRECATED QtMsgHandler qInstallMsgHandler(QtMsgHandler);
     164             : #endif
     165             : 
     166             : typedef void (*QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &);
     167             : Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler);
     168             : 
     169             : Q_CORE_EXPORT void qSetMessagePattern(const QString &messagePattern);
     170             : 
     171             : QT_END_NAMESPACE
     172             : #endif // QLOGGING_H

Generated by: LCOV version 1.11