Akonadi

akscopeguard.h
1 /*
2  SPDX-FileCopyrightText: 2019 Daniel Vrátil <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_AKSCOPEGUARD_H_
8 #define AKONADI_AKSCOPEGUARD_H_
9 
10 #include <functional>
11 #include <type_traits>
12 
13 namespace Akonadi {
14 
15 class AkScopeGuard
16 {
17 public:
18  template<typename U>
19  AkScopeGuard(U &&fun)
20  : mFun(std::move(fun))
21  {}
22 
23  AkScopeGuard(const AkScopeGuard &) = delete;
24  AkScopeGuard(AkScopeGuard &&) = default;
25  AkScopeGuard &operator=(const AkScopeGuard &) = delete;
26  AkScopeGuard &operator=(AkScopeGuard &&) = delete;
27 
28  ~AkScopeGuard()
29  {
30  mFun();
31  }
32 
33 private:
34  std::function<void()> mFun;
35 };
36 
37 } // namespace Akonadi
38 
39 #endif
A glue between Qt and the standard library.
Helper integration between Akonadi and Qt.
KIOCORE_EXPORT CopyJob * move(const QUrl &src, const QUrl &dest, JobFlags flags=DefaultFlags)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 6 2020 23:15:17 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.