Debian Codegraph @

src/App/CleanupProcess.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2024 Werner Mayer <wmayer[at]users.sourceforge.net> *
5 * *
6 * This file is part of FreeCAD. *
7 * *
8 * FreeCAD is free software: you can redistribute it and/or modify it *
9 * under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation, either version 2.1 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * FreeCAD is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with FreeCAD. If not, see *
20 * <https://www.gnu.org/licenses/>. *
21 * *
22 **************************************************************************/
23
24 #ifndef APP_CLEANUPPROCESS_H
25 #define APP_CLEANUPPROCESS_H
26
27 #include <functional>
28 #include <FCGlobal.h>
29
30 namespace App
31 {
32
33 /*!
34 * \brief The CleanupProcess class
35 */
36 class AppExport CleanupProcess
37 {
38 public:
39 /*!
40 * \brief registerCleanup
41 * \param func
42 * This adds a callback function that will be called when the application
43 * is about to be shut down.
44 * @note A callback function is only about to free resources. Accessing
45 * stuff of the application like parameter groups should be avoided.
46 */
47 static void registerCleanup(const std::function<void()>& func);
48 /*!
49 * \brief callCleanup
50 * Calls the functions that are registered with \a registerCleanup.
51 */
52 static void callCleanup();
53 };
54
55 } // namespace App
56
57 #endif // APP_CLEANUPPROCESS_H