umbrello: Tracer Class Reference

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

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Static Private Attributes | List of all members
Tracer Class Reference

The singleton class for switching on or off debug messages. More...

`#include <debug_utils.h>`

Inheritance diagram for Tracer:

## Classes
class | MapEntry

## Public Member Functions
| ~Tracer ()
bool | isEnabled (const QString &name) const
void | enable (const QString &name)
void | disable (const QString &name)
void | enableAll ()
void | disableAll ()
bool | logToConsole ()

## Static Public Member Functions
static Tracer * | instance ()
static void | registerClass (const char *name, bool state=true, const char *filePath=0)

## Protected Member Functions
void | update (const QString &name)
void | updateParentItemCheckBox (QTreeWidgetItem *parent)
virtual void | showEvent (QShowEvent *)

## Private Types
typedef QMap< QString, MapEntry > | MapType
typedef QMap< QString, Qt::CheckState > | StateMap

## Private Slots
void | slotParentItemClicked (QTreeWidgetItem *parent)
void | slotItemClicked (QTreeWidgetItem *item, int column)

## Private Member Functions
| Tracer (QWidget *parent=0)

## Static Private Attributes
static Tracer * | s_instance = nullptr
static MapType * | s_classes
static StateMap * | s_states
static bool | s_logToConsole

## Detailed Description

The singleton class for switching on or off debug messages.

This class provides a user controllable way to enable class related debug output.

Classes could be registered with the static method registerClass().

With show() a dialog will be shown, in which the user is able to enable/disable debug output for each registered class.

Class related debug output implementation

To register classes independent from related object instantiation time one of the macros

DEBUG_REGISTER(className) DEBUG_REGISTER_DISABLED(className)

should be placed in the implementation part of a class before the first class methods. The first macro enables debug output for the related class, while the latter macro disables it by default.

Debug output in class methods should use

- QObject based classes

  DEBUG() << ...

- other classes (Debug with given Name)

  DEBUG_N("class name") << ...

## Member Typedef Documentation

## ◆ MapType

typedef QMap<QString, MapEntry> Tracer::MapType
| private

## ◆ StateMap

typedef QMap<QString,Qt::CheckState> Tracer::StateMap
| private

## Constructor & Destructor Documentation

## ◆ ~Tracer()

Tracer::~Tracer | ( |  | ) |

Destructor.

## ◆ Tracer()

Tracer::Tracer | ( | QWidget * | parent = `0` | ) |
| explicitprivate

Constructor.

Parameters

  parent | the parent widget

## Member Function Documentation

## ◆ disable()

void Tracer::disable | ( | const QString & | name | ) |

Disable debug output for the given class.

Parameters

  name | class name

## ◆ disableAll()

void Tracer::disableAll | ( |  | ) |

## ◆ enable()

void Tracer::enable | ( | const QString & | name | ) |

Enable debug output for the given class.

Parameters

  name | class name

## ◆ enableAll()

void Tracer::enableAll | ( |  | ) |

## ◆ instance()

Tracer * Tracer::instance | ( |  | ) |
| static

## ◆ isEnabled()

bool Tracer::isEnabled | ( | const QString & | name | ) | const

Return debugging state for a given class

Parameters

  name | the class name to check

## ◆ logToConsole()

bool Tracer::logToConsole | ( |  | ) |

## ◆ registerClass()

void Tracer::registerClass | ( | const char * | name,
|  | bool | state = `true`,
|  | const char * | filePath = `0`
| ) |  |
| static

Register class for debug output

Parameters

  name | class name
  state | initial enabled state
  filePath | path qualified source filename of class

## ◆ showEvent()

void Tracer::showEvent | ( | QShowEvent * | e | ) |
| protectedvirtual

Fill tree widget with collected classes.

## ◆ slotItemClicked

void Tracer::slotItemClicked | ( | QTreeWidgetItem * | item,
|  | int | column
| ) |  |
| privateslot

handle tree widget item selection signal

Parameters

  item | tree widget item
  column | selected column

## ◆ slotParentItemClicked

void Tracer::slotParentItemClicked | ( | QTreeWidgetItem * | parent | ) |
| privateslot

## ◆ update()

void Tracer::update | ( | const QString & | name | ) |
| protected

Transfer class state into tree widget.

Parameters

  name | class name

## ◆ updateParentItemCheckBox()

void Tracer::updateParentItemCheckBox | ( | QTreeWidgetItem * | parent | ) |
| protected

Update check box of parent items.

Parameters

  parent | parent widget item

## Member Data Documentation

## ◆ s_classes

Tracer::MapType * Tracer::s_classes
| staticprivate

## ◆ s_instance

Tracer * Tracer::s_instance = nullptr
| staticprivate

## ◆ s_logToConsole

bool Tracer::s_logToConsole
| staticprivate

## ◆ s_states

Tracer::StateMap * Tracer::s_states
| staticprivate

The documentation for this class was generated from the following files:

- umbrello/debug/debug_utils.h
- umbrello/debug/debug_utils.cpp