Marble

MarbleDebug.cpp
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Patrick Spendrin <[email protected]>
9 //
10 
11 #include "MarbleDebug.h"
12 
13 namespace Marble
14 {
15 bool MarbleDebug::m_enabled = false;
16 
17 class NullDevice : public QIODevice
18 {
19 public:
20  NullDevice()
21  {
23  }
24 
25  qint64 readData( char * /*data*/, qint64 /*maxSize*/ ) override
26  {
27  return -1;
28  }
29 
30  qint64 writeData( const char * /*data*/, qint64 maxSize ) override
31  {
32  return maxSize;
33  }
34 };
35 
37 {
38  if ( MarbleDebug::isEnabled() ) {
39  return QDebug( QtDebugMsg );
40  }
41  else {
42  static QIODevice *device = new NullDevice;
43  return QDebug( device );
44  }
45 }
46 
48 {
49  return MarbleDebug::m_enabled;
50 }
51 
52 void MarbleDebug::setEnabled(bool enabled)
53 {
54  MarbleDebug::m_enabled = enabled;
55 }
56 
57 } // namespace Marble
Binds a QML item to a specific geodetic location in screen coordinates.
virtual bool open(QIODevice::OpenMode mode)
static bool isEnabled()
isEnabled returns whether debug information output is generated
Definition: MarbleDebug.cpp:47
static void setEnabled(bool enabled)
setEnabled Toggle debug information output generation
Definition: MarbleDebug.cpp:52
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 11 2020 23:19:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.