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 #pragma once
8 
9 #include <functional>
10 #include <type_traits>
11 
12 namespace Akonadi
13 {
14 class AkScopeGuard
15 {
16 public:
17  template<typename U>
18  AkScopeGuard(U &&fun)
19  : mFun(std::move(fun))
20  {
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 
KIOCORE_EXPORT CopyJob * move(const QList< QUrl > &src, const QUrl &dest, JobFlags flags=DefaultFlags)
A glue between Qt and the standard library.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.