xtd 0.2.0
Loading...
Searching...
No Matches
event.hpp
Go to the documentation of this file.
1
4#pragma once
6namespace xtd {
20 template<typename object_t, typename handler_t>
21 class event : protected handler_t {
22 friend object_t;
23 public:
25
29 bool is_empty() const noexcept {
30 return handler_t::is_empty();
31 }
33
35
40 handler_t& operator +=(const handler_t& handler) noexcept {
41 return handler_t::operator +=(handler);
42 }
43
47 handler_t& operator +=(const typename handler_t::function_t& function) noexcept {
48 return handler_t::operator +=(function);
49 }
50
54 template<typename fn_t>
55 handler_t& operator +=(fn_t function) noexcept {
56 return handler_t::operator +=(function);
57 }
58
62 handler_t& operator -=(const handler_t& handler) noexcept {
63 return handler_t::operator -=(handler);
64 }
65
69 handler_t& operator -=(const typename handler_t::function_t& function) noexcept {
70 return handler_t::operator -=(function);
71 }
72
76 template<typename fn_t>
77 handler_t& operator -=(fn_t function) noexcept {
78 return handler_t::operator -=(function);
79 }
80
82 void clear() noexcept {
83 *this = event {};
84 }
86 };
87}
Represents an event.
Definition event.hpp:21
void clear() noexcept
Clear event.
Definition event.hpp:82
handler_t & operator+=(const handler_t &handler) noexcept
Adds an handler to the event.
Definition event.hpp:40
handler_t & operator-=(const handler_t &handler) noexcept
Removes an handler to the event.
Definition event.hpp:62
bool is_empty() const noexcept
Gets a value indicate if the event is empty.
Definition event.hpp:29
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10