umbrello: umbrello/debug/debug_utils.h File Reference

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

Classes | Macros
debug_utils.h File Reference
`#include <QtGlobal>`
`#include <kdebug.h>`
`#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() kDebug(8060)
#define | uError() kError(8060)
#define | uWarning() kWarning(8060)
#define | DBG_SRC QString::fromLatin1(metaObject()->className())
#define | DEBUG_SHOW_FILTER() Tracer::instance()->show()
#define | DEBUG(src) if (Tracer::instance()->isEnabled(src)) uDebug()
#define | IS_DEBUG_ENABLED(src) Tracer::instance()->isEnabled(QString::fromLatin1(#src))
#define | DEBUG_REGISTER(src) class src##Tracer { public: src##Tracer() { Tracer::registerClass(QString::fromLatin1(#src), true, QLatin1String(__FILE__)); } }; static src##Tracer src##TracerGlobal;
#define | DEBUG_REGISTER_DISABLED(src) class src##Tracer { public: src##Tracer() { Tracer::registerClass(QString::fromLatin1(#src), false, QLatin1String(__FILE__)); } }; static src##Tracer src##TracerGlobal;
#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 | ( |  | src | ) | if (Tracer::instance()->isEnabled(src)) uDebug()

## ◆ DEBUG_REGISTER

#define DEBUG_REGISTER | ( |  | src | ) | class src##Tracer { public: src##Tracer() { Tracer::registerClass(QString::fromLatin1(#src), true, QLatin1String(__FILE__)); } }; static src##Tracer src##TracerGlobal;

## ◆ DEBUG_REGISTER_DISABLED

#define DEBUG_REGISTER_DISABLED | ( |  | src | ) | class src##Tracer { public: src##Tracer() { Tracer::registerClass(QString::fromLatin1(#src), false, QLatin1String(__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 | ( |  | src | ) | Tracer::instance()->isEnabled(QString::fromLatin1(#src))

## ◆ uDebug

#define uDebug | ( |  | ) | kDebug(8060)

## ◆ uError

#define uError | ( |  | ) | kError(8060)

## ◆ uIgnoreZeroPointer

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

## ◆ uWarning

#define uWarning | ( |  | ) | kWarning(8060)