mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
32 lines
473 B
C++
32 lines
473 B
C++
#pragma once
|
|
#include <functional>
|
|
#include <vector>
|
|
|
|
template <class T>
|
|
class Event
|
|
{
|
|
public:
|
|
Event& operator+=(T& act)
|
|
{
|
|
events.push_back(act);
|
|
return *this;
|
|
}
|
|
|
|
const Event& operator()()const
|
|
{
|
|
for (auto& event : events)
|
|
event();
|
|
return *this;
|
|
}
|
|
|
|
void clear()
|
|
{
|
|
events.clear();
|
|
}
|
|
|
|
inline std::size_t size() const {return events.size();}
|
|
|
|
protected:
|
|
std::vector<T> events;
|
|
};
|