xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
event.h
Go to the documentation of this file.
1 #pragma once
5 
7 namespace xtd {
20  template<typename object_t, typename handler_t>
21  class event : protected handler_t {
22  friend object_t;
23  public:
26  bool is_empty() const noexcept { return handler_t::is_empty(); }
27 
31  handler_t& operator+=(const handler_t& handler) noexcept {
32  return handler_t::operator+=(handler);
33  }
34 
38  handler_t& operator+=(const typename handler_t::function_t& function) noexcept {
39  return handler_t::operator+=(function);
40  }
41 
45  template<typename fn_t>
46  handler_t& operator+=(fn_t function) noexcept {
47  return handler_t::operator+=(function);
48  }
49 
53  handler_t& operator-=(const handler_t& handler) noexcept {
54  return handler_t::operator-=(handler);
55  }
56 
60  handler_t& operator-=(const typename handler_t::function_t& function) noexcept {
61  return handler_t::operator-=(function);
62  }
63 
67  template<typename fn_t>
68  handler_t& operator-=(fn_t function) noexcept {
69  return handler_t::operator-=(function);
70  }
71  };
72 }
Represents an event.
Definition: event.h:21
handler_t & operator-=(const typename handler_t::function_t &function) noexcept
Removes a function to the event.
Definition: event.h:60
handler_t & operator-=(fn_t function) noexcept
Removes a function to the event.
Definition: event.h:68
handler_t & operator+=(fn_t function) noexcept
Adds a function to the event.
Definition: event.h:46
handler_t & operator+=(const typename handler_t::function_t &function) noexcept
Adds a function to the event.
Definition: event.h:38
handler_t & operator+=(const handler_t &handler) noexcept
Adds an handler to the event.
Definition: event.h:31
handler_t & operator-=(const handler_t &handler) noexcept
Removes an handler to the event.
Definition: event.h:53
bool is_empty() const noexcept
Gets a value indicate if the event is empty.
Definition: event.h:26
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17