Marble

MarbleDebug.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2009 Patrick Spendrin <[email protected]>
4 //
5 
6 #include "MarbleDebug.h"
7 
8 namespace Marble
9 {
10 bool MarbleDebug::m_enabled = false;
11 
12 class NullDevice : public QIODevice
13 {
14 public:
15  NullDevice()
16  {
18  }
19 
20  qint64 readData( char * /*data*/, qint64 /*maxSize*/ ) override
21  {
22  return -1;
23  }
24 
25  qint64 writeData( const char * /*data*/, qint64 maxSize ) override
26  {
27  return maxSize;
28  }
29 };
30 
32 {
33  if ( MarbleDebug::isEnabled() ) {
34  return QDebug( QtDebugMsg );
35  }
36  else {
37  static QIODevice *device = new NullDevice;
38  return QDebug( device );
39  }
40 }
41 
43 {
44  return MarbleDebug::m_enabled;
45 }
46 
47 void MarbleDebug::setEnabled(bool enabled)
48 {
49  MarbleDebug::m_enabled = enabled;
50 }
51 
52 } // namespace Marble
virtual bool open(QIODevice::OpenMode mode)
Binds a QML item to a specific geodetic location in screen coordinates.
static bool isEnabled()
isEnabled returns whether debug information output is generated
Definition: MarbleDebug.cpp:42
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
static void setEnabled(bool enabled)
setEnabled Toggle debug information output generation
Definition: MarbleDebug.cpp:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Jun 28 2022 03:53:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.