mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-16 03:26:01 +01:00
20 lines
398 B
C++
20 lines
398 B
C++
|
#pragma once
|
||
|
|
||
|
#include <functional>
|
||
|
#include <any>
|
||
|
#include <vector>
|
||
|
#include <memory>
|
||
|
|
||
|
#include "Listener.hpp"
|
||
|
|
||
|
class CSignal {
|
||
|
public:
|
||
|
void emit(std::any data);
|
||
|
|
||
|
//
|
||
|
[[nodiscard("Listener is unregistered when the ptr is lost")]] CHyprSignalListener registerListener(std::function<void(std::any)> handler);
|
||
|
|
||
|
private:
|
||
|
std::vector<std::weak_ptr<CSignalListener>> m_vListeners;
|
||
|
};
|