CVB++ 14.1
EventCookie Class Reference

Cookie used to unregister event handlers. More...

#include <cvb/global.hpp>

Public Member Functions

 EventCookie () noexcept=default
 Creates an empty cookie for convenience. More...
 
 operator bool () const noexcept
 Checks if the cookie carries a registered event. More...
 

Detailed Description

Cookie used to unregister event handlers.

A cookie object created and returned, each time an event handler is registered. An event handler can either be a classic callback or a c++ lamda. Either way there is no standard way to unregister such a handler, so the cookie is needed to do this manually. If the object, to which a specific event handler was registered to is destroyed the cookie will be useless and should be destroyed as well.

Examples
Cvb/QtDisplayAdvanced, and GevServer/QmlGevServer.

Constructor & Destructor Documentation

◆ EventCookie()

EventCookie ( )
defaultnoexcept

Creates an empty cookie for convenience.

Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

Checks if the cookie carries a registered event.

Exceptions
Doesnot throw any exception.