swift
connectionguard.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_CONNECTIONGUARD_H
7 #define SWIFT_MISC_CONNECTIONGUARD_H
8 
9 #include <QList>
10 #include <QMetaObject>
11 
12 #include "misc/swiftmiscexport.h"
13 
14 namespace swift::misc
15 {
22  {
23  public:
25  CConnectionGuard() = default;
26 
28  CConnectionGuard(const QMetaObject::Connection &connection);
29 
32 
35 
41 
44 
46  bool append(const QMetaObject::Connection &connection);
47 
49  bool append(const QList<QMetaObject::Connection> &connections);
50 
52  int disconnectAll();
53 
55  bool isEmpty() const { return m_connections.isEmpty(); }
56 
57  private:
58  QList<QMetaObject::Connection> m_connections;
59  };
60 } // namespace swift::misc
61 
62 #endif // SWIFT_MISC_CONNECTIONGUARD_H
List of QMetaObject::Connection.
CConnectionGuard(CConnectionGuard &&)=default
Move constructor.
CConnectionGuard()=default
Constructor.
CConnectionGuard(const CConnectionGuard &)=delete
Not copyable.
CConnectionGuard & operator=(const CConnectionGuard &)=delete
Not copyable.
CConnectionGuard & operator=(CConnectionGuard &&)=default
Move assignment operator.
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.