KDbMessageGuard
#include <KDbMessageHandler.h>
Public Member Functions | |
KDbMessageGuard (const KDbResult &result, KDbMessageHandler *handler) | |
KDbMessageGuard (KDbResultable *resultable) | |
Protected Attributes | |
Private *const | d |
Detailed Description
A guard class for transmitting messages based on KDbResult.
It's intended use is for top-level public methods in applications that have to display messages. Create it's instance on stack; at the end of the block, on KDbMessageGuard's destruction result will be checked. If it's not empty, error is passed to the associated message handler. The example below emits error message if result is not empty before .
There are two equivalent variants of usage:
- using the KDbResultable object as in the example above (recommended)
- using a reference to a KDbResult and a KDbMessageHandler
- Note
- instantiating KDbMessageGuard objects on the heap makes not much sense.
Definition at line 65 of file KDbMessageHandler.h.
Constructor & Destructor Documentation
◆ KDbMessageGuard() [1/2]
|
explicit |
Builds a guard in the current code block using resultable Infromation from resultable will be used in ~KDbMessageGuard() to pass message to the resultable->messageHandler() handler if the handler is present and resultable->result().isError() == true.
- Note
- resultable is required
Definition at line 35 of file KDbMessageHandler.cpp.
◆ KDbMessageGuard() [2/2]
KDbMessageGuard::KDbMessageGuard | ( | const KDbResult & | result, |
KDbMessageHandler * | handler ) |
Builds a guard in the current code block using a reference to result and handler These will be used in ~KDbMessageGuard() is result.isError() == true.
- Note
- handler is required
Definition at line 43 of file KDbMessageHandler.cpp.
◆ ~KDbMessageGuard()
KDbMessageGuard::~KDbMessageGuard | ( | ) |
Definition at line 51 of file KDbMessageHandler.cpp.
Member Data Documentation
◆ d
|
protected |
Definition at line 85 of file KDbMessageHandler.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 1 2024 18:50:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.