xtd 0.2.0
event.h
Go to the documentation of this file.
1 #pragma once
5 namespace 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 }
bool is_empty() const noexcept
Gets a value indicate if the event is empty.
Definition: event.h:29
handler_t & operator-=(const handler_t &handler) noexcept
Removes an handler to the event.
Definition: event.h:62
void clear() noexcept
Clear event.
Definition: event.h:82
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
handler_t & operator+=(const handler_t &handler) noexcept
Adds an handler to the event.
Definition: event.h:40
Represents an event.
Definition: event.h:21