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 [[nodiscard]] auto is_empty() const noexcept -> bool {return handler_t::is_empty();}
31
33
38 auto operator +=(const handler_t& handler) noexcept -> handler_t& {return handler_t::operator +=(handler);}
39
43 auto operator +=(const typename handler_t::function_t& function) noexcept -> handler_t& {return handler_t::operator +=(function);}
44
48 template<typename fn_t>
49 auto operator +=(fn_t function) noexcept -> handler_t& {return handler_t::operator +=(function);}
50
54 auto operator -=(const handler_t& handler) noexcept -> handler_t& {return handler_t::operator -=(handler);}
55
59 auto operator -=(const typename handler_t::function_t& function) noexcept -> handler_t& {return handler_t::operator -=(function);}
60
64 template<typename fn_t>
65 auto operator -=(fn_t function) noexcept -> handler_t& {return handler_t::operator -=(function);}
66
68 auto clear() noexcept -> void {*this = event {};}
70 };
71}
Represents an event.
Definition event.hpp:21
auto is_empty() const noexcept -> bool
Gets a value indicate if the event is empty.
Definition event.hpp:29
auto clear() noexcept -> void
Clear event.
Definition event.hpp:68
auto operator+=(const handler_t &handler) noexcept -> handler_t &
Adds an handler to the event.
Definition event.hpp:38
auto operator-=(const handler_t &handler) noexcept -> handler_t &
Removes an handler to the event.
Definition event.hpp:54
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8