From 513296b868df8a3c5a55290d3146cba017418926 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 13 Dec 2022 01:21:23 -0500 Subject: Use std::variant --- src/AtomWriter.cpp | 5 ++--- src/SocketWriter.cpp | 5 ++--- src/client/ClientStore.cpp | 4 ++-- src/gui/App.cpp | 10 +++++----- src/gui/BreadCrumbs.cpp | 4 ++-- src/gui/ConnectWindow.cpp | 6 +++--- src/server/EventWriter.cpp | 4 ++-- 7 files changed, 18 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index e8418de1..604bafdc 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -64,13 +64,12 @@ #include "raul/Path.hpp" #include "serd/serd.h" -#include - #include #include #include #include #include +#include namespace ingen { @@ -92,7 +91,7 @@ AtomWriter::finish_msg() void AtomWriter::message(const Message& message) { - boost::apply_visitor(*this, message); + std::visit(*this, message); } /** @page protocol diff --git a/src/SocketWriter.cpp b/src/SocketWriter.cpp index c705ed96..6bbab6cb 100644 --- a/src/SocketWriter.cpp +++ b/src/SocketWriter.cpp @@ -19,11 +19,10 @@ #include "ingen/URI.hpp" #include "raul/Socket.hpp" -#include - #include #include #include +#include #ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 @@ -43,7 +42,7 @@ void SocketWriter::message(const Message& message) { TurtleWriter::message(message); - if (boost::get(&message)) { + if (std::get_if(&message)) { // Send a null byte to indicate end of bundle const char end[] = { 0 }; send(_socket->fd(), end, 1, MSG_NOSIGNAL); diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 80143265..02f28324 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -33,7 +33,6 @@ #include "ingen/paths.hpp" #include "raul/Path.hpp" -#include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include namespace ingen { namespace client { @@ -244,7 +244,7 @@ ClientStore::operator()(const Move& msg) void ClientStore::message(const Message& msg) { - boost::apply_visitor(*this, msg); + std::visit(*this, msg); } void diff --git a/src/gui/App.cpp b/src/gui/App.cpp index ff9636b9..7ec6014e 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -47,7 +47,6 @@ #include "lilv/lilv.h" #include "suil/suil.h" -#include #include #include #include @@ -73,6 +72,7 @@ #include #include #include +#include namespace ingen { namespace gui { @@ -239,13 +239,13 @@ App::serialiser() void App::message(const Message& msg) { - if (const Response* const r = boost::get(&msg)) { + if (const Response* const r = std::get_if(&msg)) { response(r->id, r->status, r->subject); - } else if (const Error* const e = boost::get(&msg)) { + } else if (const Error* const e = std::get_if(&msg)) { error_message(e->message); - } else if (const Put* const p = boost::get(&msg)) { + } else if (const Put* const p = std::get_if(&msg)) { put(p->uri, p->properties, p->ctx); - } else if (const SetProperty* const s = boost::get(&msg)) { + } else if (const SetProperty* const s = std::get_if(&msg)) { property_change(s->subject, s->predicate, s->value, s->ctx); } } diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 46a0757a..942b88f5 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -22,12 +22,12 @@ #include "ingen/client/SigClientInterface.hpp" #include "raul/Symbol.hpp" -#include #include #include #include #include +#include namespace ingen { namespace gui { @@ -196,7 +196,7 @@ BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb) void BreadCrumbs::message(const Message& msg) { - if (const Del* const del = boost::get(&msg)) { + if (const Del* const del = std::get_if(&msg)) { object_destroyed(del->uri); } } diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index a4c8a433..4569acec 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -37,7 +37,6 @@ #include "raul/Path.hpp" #include "raul/Process.hpp" -#include #include #include #include @@ -62,6 +61,7 @@ #include #include #include +#include namespace ingen { namespace gui { @@ -75,9 +75,9 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, void ConnectWindow::message(const Message& msg) { - if (const Response* const r = boost::get(&msg)) { + if (const Response* const r = std::get_if(&msg)) { ingen_response(r->id, r->status, r->subject); - } else if (const Error* const e = boost::get(&msg)) { + } else if (const Error* const e = std::get_if(&msg)) { error(e->message); } } diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index e9fb56a6..e61b7624 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -29,7 +29,7 @@ #include "events/Move.hpp" #include "events/Undo.hpp" -#include +#include namespace ingen { namespace server { @@ -47,7 +47,7 @@ EventWriter::now() const void EventWriter::message(const Message& msg) { - boost::apply_visitor(*this, msg); + std::visit(*this, msg); } void -- cgit v1.2.1