umbrello 26.07.70-c53146a Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Classes | Namespaces | Macros | Functions
debug_utils.h File Reference
`#include <QtGlobal>`
`#include <QLoggingCategory>`
`#include <QMetaEnum>`
`#include <QTreeWidget>`

Go to the source code of this file.

## Classes

class | Tracer
| The singleton class for switching on or off debug messages. More...
class | Tracer::MapEntry

## Namespaces

namespace | Settings

## Macros

#define | uDebug() qCDebug(UMBRELLO)
#define | uError() qCCritical(UMBRELLO)
#define | uWarning() qCWarning(UMBRELLO)
#define | DBG_SRC QString::fromLatin1(metaObject()->className())
#define | DEBUG_SHOW_FILTER() Tracer::instance()->show()
#define | DEBUG_N(latin1str) if (Tracer::instance()->logToConsole() || Tracer::instance()->isEnabled(latin1str)) uDebug()
#define | DEBUG() DEBUG_N(DBG_SRC)
#define | IS_DEBUG_ENABLED() Tracer::instance()->isEnabled(DBG_SRC)
#define | DEBUG_REGISTER(src)
#define | DEBUG_REGISTER_DISABLED(src)
#define | uIgnoreZeroPointer(a) if (!a) { uDebug() << "zero pointer detected" << __FILE__ << __LINE__; continue; }
#define | ENUM_NAME(o, e, v) (o::staticMetaObject.enumerator(o::staticMetaObject.indexOfEnumerator(#e)).valueToKey((v)))
#define | logDebug0(s)
#define | logInfo0(s) UMLApp::app()->logInfo(QStringLiteral(s))
#define | logWarn0(s) UMLApp::app()->logWarn(QStringLiteral(s))
#define | logError0(s) UMLApp::app()->logError(QStringLiteral(s))
#define | logDebug1(s, a)
#define | logInfo1(s, a) do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logInfo(fmt); } while (0)
#define | logWarn1(s, a) do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logWarn(fmt); } while (0)
#define | logError1(s, a) do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logError(fmt); } while (0)
#define | logDebug2(s, a, b)
#define | logInfo2(s, a, b) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logInfo(fmt); } while (0)
#define | logWarn2(s, a, b) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logWarn(fmt); } while (0)
#define | logError2(s, a, b) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logError(fmt); } while (0)
#define | logDebug3(s, a, b, c)
#define | logInfo3(s, a, b, c) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logInfo(fmt); } while (0)
#define | logWarn3(s, a, b, c) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logWarn(fmt); } while (0)
#define | logError3(s, a, b, c) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logError(fmt); } while (0)
#define | logDebug4(s, a, b, c, d)
#define | logInfo4(s, a, b, c, d) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logInfo(fmt); } while (0)
#define | logWarn4(s, a, b, c, d) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logWarn(fmt); } while (0)
#define | logError4(s, a, b, c, d) do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logError(fmt); } while (0)
#define | logDebug5(s, a, b, c, d, e)
#define | logInfo5(s, a, b, c, d, e)
#define | logWarn5(s, a, b, c, d, e)
#define | logError5(s, a, b, c, d, e)
#define | logDebug6(s, a, b, c, d, e, f)

## Functions

template<typename T >
QString | toString (const T &value)

## Macro Definition Documentation

## ◆ DBG_SRC

#define DBG_SRC QString::fromLatin1(metaObject()->className())

## ◆ DEBUG

#define DEBUG | ( |  | ) | DEBUG_N(DBG_SRC)

## ◆ DEBUG_N

#define DEBUG_N | ( |  | latin1str | ) | if (Tracer::instance()->logToConsole() || Tracer::instance()->isEnabled(latin1str)) uDebug()

## ◆ DEBUG_REGISTER

#define DEBUG_REGISTER | ( |  | src | ) |

Value:
class src##Tracer { \
public: \
src##Tracer() { Tracer::registerClass(#src, true, __FILE__); } \
}; \
static src##Tracer src##TracerGlobal;
Tracer
The singleton class for switching on or off debug messages.
Definition: debug_utils.h:60
Tracer::registerClass
static void registerClass(const char *name, bool state=true, const char *filePath=nullptr)
Definition: debug_utils.cpp:254

## ◆ DEBUG_REGISTER_DISABLED

#define DEBUG_REGISTER_DISABLED | ( |  | src | ) |

Value:
class src##Tracer { \
public: \
src##Tracer() { Tracer::registerClass(#src, false, __FILE__); } \
}; \
static src##Tracer src##TracerGlobal;

## ◆ DEBUG_SHOW_FILTER

#define DEBUG_SHOW_FILTER | ( |  | ) | Tracer::instance()->show()

## ◆ ENUM_NAME

#define ENUM_NAME | ( |  | o,
|  |  | e,
|  |  | v
| ) |  | (o::staticMetaObject.enumerator(o::staticMetaObject.indexOfEnumerator(#e)).valueToKey((v)))

In a Q_OBJECT class define any enum as Q_ENUMS. With the above the following macro returns the name of a given enum. This can be used in debug output. TODO: convert it to a function.

## ◆ IS_DEBUG_ENABLED

#define IS_DEBUG_ENABLED | ( |  | ) | Tracer::instance()->isEnabled(DBG_SRC)

## ◆ logDebug0

#define logDebug0 | ( |  | s | ) |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
UMLApp::app()->logDebug(QStringLiteral(s))
Tracer::instance
static Tracer * instance()
Definition: debug_utils.cpp:113
UMLApp::app
static UMLApp * app()
Definition: umlapp.cpp:284
DBG_SRC
#define DBG_SRC
Definition: debug_utils.h:116

## ◆ logDebug1

#define logDebug1 | ( |  | s,
|  |  | a
| ) |  |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logDebug(fmt); } while (0)
UMLApp::logDebug
void logDebug(const QString &s)
Definition: umlapp.cpp:1780
a
QString a
Definition: petalnode.cpp:13

## ◆ logDebug2

#define logDebug2 | ( |  | s,
|  |  | a,
|  |  | b
| ) |  |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logDebug(fmt); } while (0)
b
bool b
Definition: cxx11-null-pointer-constant.h:6

## ◆ logDebug3

#define logDebug3 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c
| ) |  |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logDebug(fmt); } while (0)

## ◆ logDebug4

#define logDebug4 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logDebug(fmt); } while (0)

## ◆ logDebug5

#define logDebug5 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d).arg(e); \
UMLApp::app()->logDebug(fmt); } while (0)

## ◆ logDebug6

#define logDebug6 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f
| ) |  |

Value:
if (UMLApp::app()->logToConsole() || Tracer::instance()->isEnabled(DBG_SRC)) \
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d).arg(e).arg(f); UMLApp::app()->logDebug(fmt); } while (0)

## ◆ logError0

#define logError0 | ( |  | s | ) | UMLApp::app()->logError(QStringLiteral(s))

## ◆ logError1

#define logError1 | ( |  | s,
|  |  | a
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logError(fmt); } while (0)

## ◆ logError2

#define logError2 | ( |  | s,
|  |  | a,
|  |  | b
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logError(fmt); } while (0)

## ◆ logError3

#define logError3 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logError(fmt); } while (0)

## ◆ logError4

#define logError4 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logError(fmt); } while (0)

## ◆ logError5

#define logError5 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  |

Value:
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d).arg(e); \
UMLApp::app()->logError(fmt); } while (0)

## ◆ logInfo0

#define logInfo0 | ( |  | s | ) | UMLApp::app()->logInfo(QStringLiteral(s))

## ◆ logInfo1

#define logInfo1 | ( |  | s,
|  |  | a
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logInfo(fmt); } while (0)

## ◆ logInfo2

#define logInfo2 | ( |  | s,
|  |  | a,
|  |  | b
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logInfo(fmt); } while (0)

## ◆ logInfo3

#define logInfo3 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logInfo(fmt); } while (0)

## ◆ logInfo4

#define logInfo4 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logInfo(fmt); } while (0)

## ◆ logInfo5

#define logInfo5 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  |

Value:
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d).arg(e); \
UMLApp::app()->logInfo(fmt); } while (0)

## ◆ logWarn0

#define logWarn0 | ( |  | s | ) | UMLApp::app()->logWarn(QStringLiteral(s))

## ◆ logWarn1

#define logWarn1 | ( |  | s,
|  |  | a
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a); UMLApp::app()->logWarn(fmt); } while (0)

## ◆ logWarn2

#define logWarn2 | ( |  | s,
|  |  | a,
|  |  | b
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b); UMLApp::app()->logWarn(fmt); } while (0)

## ◆ logWarn3

#define logWarn3 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c); UMLApp::app()->logWarn(fmt); } while (0)

## ◆ logWarn4

#define logWarn4 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d); UMLApp::app()->logWarn(fmt); } while (0)

## ◆ logWarn5

#define logWarn5 | ( |  | s,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e
| ) |  |

Value:
do { QString fmt = QString(QStringLiteral(s)).arg(a).arg(b).arg(c).arg(d).arg(e); \
UMLApp::app()->logWarn(fmt); } while (0)

## ◆ uDebug

#define uDebug | ( |  | ) | qCDebug(UMBRELLO)

## ◆ uError

#define uError | ( |  | ) | qCCritical(UMBRELLO)

## ◆ uIgnoreZeroPointer

#define uIgnoreZeroPointer | ( |  | a | ) | if (!a) { uDebug() << "zero pointer detected" << __FILE__ << __LINE__; continue; }

## ◆ uWarning

#define uWarning | ( |  | ) | qCWarning(UMBRELLO)

## Function Documentation

## ◆ toString()

template<typename T >

QString toString | ( | const T & | value | ) |