LeechCraft 0.6.70-17335-ge406ffdcaf
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
raiisignalconnection.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
10#include <QObject>
11
12namespace LC::Util
13{
14 RaiiSignalConnection::RaiiSignalConnection (QMetaObject::Connection conn)
15 : Conn_ { conn }
16 {
17 }
18
20 {
21 QObject::disconnect (Conn_);
22 }
23
25 : Conn_ { std::move (other.Conn_)}
26 {
27 }
28
30 {
31 Conn_.swap (other.Conn_);
32 return *this;
33 }
34
36 {
37 QObject::disconnect (Conn_);
38 Conn_ = conn;
39 return *this;
40 }
41
42 QMetaObject::Connection RaiiSignalConnection::Release () &&
43 {
44 auto conn = Conn_;
45 Conn_ = QMetaObject::Connection {};
46 return conn;
47 }
48}
RaiiSignalConnection(QMetaObject::Connection conn)
QMetaObject::Connection Release() &&
RaiiSignalConnection & operator=(const RaiiSignalConnection &)=delete