mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Replace std::monostate with std::nullptr_t
This represents the underlying meaning better since we're mostly dealing with the `data` void pointer argument.
This commit is contained in:
+3
-3
@@ -236,7 +236,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
// because it was not zeroed out by the host) for an event that should
|
||||
// report some data back?
|
||||
const auto response_data = std::visit(
|
||||
overload{[&](auto) -> EventResposnePayload { return std::monostate(); },
|
||||
overload{[&](auto) -> EventResposnePayload { return nullptr; },
|
||||
[&](const AEffect& updated_plugin) -> EventResposnePayload {
|
||||
// This is a bit of a special case! Instead of writing some
|
||||
// return value, we will update values on the native VST
|
||||
@@ -261,7 +261,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
plugin->uniqueID = updated_plugin.uniqueID;
|
||||
plugin->version = updated_plugin.version;
|
||||
|
||||
return std::monostate();
|
||||
return nullptr;
|
||||
},
|
||||
[&](WantsChunkBuffer&) -> EventResposnePayload {
|
||||
// In this case the plugin will have written its data
|
||||
@@ -290,7 +290,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
const auto time_info =
|
||||
reinterpret_cast<const VstTimeInfo*>(return_value);
|
||||
if (time_info == nullptr) {
|
||||
return std::monostate{};
|
||||
return nullptr;
|
||||
} else {
|
||||
return *time_info;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void Logger::log_event_response(bool is_dispatch,
|
||||
|
||||
std::visit(
|
||||
overload{
|
||||
[&](const std::monostate&) {},
|
||||
[&](const std::nullptr_t&) {},
|
||||
[&](const std::string& s) {
|
||||
if (s.size() < 32) {
|
||||
message << ", \"" << s << "\"";
|
||||
|
||||
@@ -295,11 +295,8 @@ struct Event {
|
||||
* - A specific struct in response to an event such as `audioMasterGetTime` or
|
||||
* `audioMasterIOChanged`.
|
||||
* - An X11 window pointer for the editor window.
|
||||
*
|
||||
* TODO: Replace `std::monostate` with `std::nullptr_t` as it's more expressive
|
||||
* in what it actually represents.
|
||||
*/
|
||||
using EventResposnePayload = std::variant<std::monostate,
|
||||
using EventResposnePayload = std::variant<std::nullptr_t,
|
||||
std::string,
|
||||
AEffect,
|
||||
VstIOProperties,
|
||||
@@ -310,7 +307,7 @@ template <typename S>
|
||||
void serialize(S& s, EventResposnePayload& payload) {
|
||||
s.ext(payload,
|
||||
bitsery::ext::StdVariant{
|
||||
[](S&, std::monostate&) {},
|
||||
[](S&, std::nullptr_t&) {},
|
||||
[](S& s, std::string& string) {
|
||||
// `binary_buffer_size` and not `max_string_length`
|
||||
// because we also use this to send back large chunk
|
||||
|
||||
@@ -302,7 +302,7 @@ class HostCallbackDataConverter : DefaultDataConverter {
|
||||
// Depending on whether the host supported the requested time
|
||||
// information this operations returns either a null pointer or
|
||||
// a pointer to a `VstTimeInfo` object.
|
||||
if (std::holds_alternative<std::monostate>(response.payload)) {
|
||||
if (std::holds_alternative<std::nullptr_t>(response.payload)) {
|
||||
time_info = std::nullopt;
|
||||
} else {
|
||||
time_info = std::get<VstTimeInfo>(response.payload);
|
||||
|
||||
Reference in New Issue
Block a user