72 : id_(id), disconnectFunc_(
std::move(disconnectFunc)) {}
86 : id_(other.id_), disconnectFunc_(std::move(other.disconnectFunc_)) {
88 other.disconnectFunc_ =
nullptr;
100 disconnectFunc_ = std::move(other.disconnectFunc_);
102 other.disconnectFunc_ =
nullptr;
115 disconnectFunc_(id_);
117 disconnectFunc_ =
nullptr;
144 disconnectFunc_ =
nullptr;
164 : connection_(
std::move(conn)) {}
173 return connection_.isConnected();
177 connection_.disconnect();
210 connections_.push_back(std::move(conn));
217 connections_.clear();
225 return connections_.size();
233 return connections_.empty();
237 std::vector<Connection> connections_;
Core type definitions and utilities for ESEngine.
bool empty() const
Check if there are any connections.
void disconnectAll()
Disconnect all managed connections.
ConnectionHolder(ConnectionHolder &&) noexcept=default
usize size() const
Get the number of active connections.
void add(Connection &&conn)
Add a connection to manage.
~ConnectionHolder()=default
ConnectionHolder()=default
RAII handle for signal connections.
std::function< void(CallbackId)> DisconnectFunc
Connection(Connection &&other) noexcept
Move constructor transfers ownership.
Connection(const Connection &)=delete
Connection(CallbackId id, DisconnectFunc disconnectFunc)
Constructs a connection with disconnect callback.
CallbackId release()
Release ownership without disconnecting.
bool isConnected() const
Check if still connected.
~Connection()
Destructor automatically disconnects.
Connection()=default
Default constructor creates an empty connection.
Connection & operator=(const Connection &)=delete
Connection & operator=(Connection &&other) noexcept
Move assignment transfers ownership.
void disconnect()
Manually disconnect from the signal.
CallbackId getId() const
Get the callback ID.
ScopedConnection(ScopedConnection &&) noexcept=default
ScopedConnection()=default
ScopedConnection(Connection &&conn)
constexpr CallbackId INVALID_CALLBACK_ID
std::uint64_t u64
Unsigned 64-bit integer.
std::size_t usize
Size type for indexing and sizes.