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

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

- File List
- File Members

Classes | Macros
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

## 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)))

## 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:58
Tracer::registerClass
static void registerClass(const char *name, bool state=true, const char *filePath=0)
Definition debug_utils.cpp:212

## ◆ 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)

## ◆ 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)