-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cxx-qt-gen: add signalhandler template and include it
Related to #595
- Loading branch information
1 parent
010910b
commit 98720c9
Showing
8 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// clang-format off | ||
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// clang-format on | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// SPDX-FileContributor: Leon Matthes <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
#pragma once | ||
|
||
#include <type_traits> | ||
|
||
#include "rust/cxx.h" | ||
|
||
namespace rust::cxxqtlib1 { | ||
|
||
template<typename CXXArguments> | ||
class SignalHandler | ||
{ | ||
|
||
public: | ||
SignalHandler() = delete; | ||
SignalHandler(const SignalHandler&) = delete; | ||
|
||
SignalHandler(SignalHandler&& other) | ||
{ | ||
data[0] = other.data[0]; | ||
data[1] = other.data[1]; | ||
other.data[0] = nullptr; | ||
other.data[1] = nullptr; | ||
} | ||
|
||
~SignalHandler() noexcept; | ||
template<typename... Arguments> | ||
void operator()(Arguments... args); | ||
|
||
private: | ||
void* data[2]; | ||
}; | ||
|
||
} // rust::cxxqtlib1 | ||
|
||
// Define namespace otherwise we hit a GCC bug | ||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 | ||
namespace rust { | ||
|
||
template<typename CXXArguments> | ||
struct IsRelocatable<rust::cxxqtlib1::SignalHandler<CXXArguments>> | ||
: ::std::true_type | ||
{ | ||
}; | ||
|
||
} // namespace rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters