Akonadi

akscopeguard.h
1/*
2 SPDX-FileCopyrightText: 2019 Daniel Vrátil <dvratil@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <functional>
10#include <type_traits>
11
12namespace Akonadi
13{
14class AkScopeGuard
15{
16public:
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
33private:
34 std::function<void()> mFun;
35};
36
37} // namespace Akonadi
Helper integration between Akonadi and Qt.
KIOCORE_EXPORT CopyJob * move(const QList< QUrl > &src, const QUrl &dest, JobFlags flags=DefaultFlags)
A glue between Qt and the standard library.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.