LeechCraft  0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
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 
9 #include "raiisignalconnection.h"
10 #include <QObject>
11 
12 namespace 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 & operator=(const RaiiSignalConnection &)=delete
QMetaObject::Connection Release() &&
auto Tup2 &&tup2 noexcept
Definition: ctstringutils.h:68