summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-22 13:06:56 -0400
committerDavid Robillard <d@drobilla.net>2022-08-22 13:07:38 -0400
commit4f6281e52d3183ae53510d59474f6e4708da40c3 (patch)
treee8b8386b865ca57c6999946213f3b1ccba5de27d
parent9c0d642a5397f418ba5c4882cc6b18e903af068f (diff)
downloadpatchage-4f6281e52d3183ae53510d59474f6e4708da40c3.tar.gz
patchage-4f6281e52d3183ae53510d59474f6e4708da40c3.tar.bz2
patchage-4f6281e52d3183ae53510d59474f6e4708da40c3.zip
Replace boost with standard C++17 facilities
-rw-r--r--.clant.json4
-rw-r--r--NEWS3
-rw-r--r--meson/suppressions/meson.build6
-rw-r--r--src/Action.hpp34
-rw-r--r--src/AlsaDriver.cpp3
-rw-r--r--src/Canvas.cpp2
-rw-r--r--src/CanvasPort.hpp40
-rw-r--r--src/Configuration.hpp11
-rw-r--r--src/Event.hpp20
-rw-r--r--src/JackLibDriver.cpp6
-rw-r--r--src/Metadata.cpp7
-rw-r--r--src/Metadata.hpp7
-rw-r--r--src/Patchage.cpp7
-rw-r--r--src/PortInfo.hpp12
-rw-r--r--src/Reactor.cpp8
-rw-r--r--src/Reactor.hpp2
-rw-r--r--src/Setting.hpp29
-rw-r--r--src/event_to_string.cpp9
-rw-r--r--src/handle_event.cpp6
19 files changed, 97 insertions, 119 deletions
diff --git a/.clant.json b/.clant.json
index d178369..23d71fd 100644
--- a/.clant.json
+++ b/.clant.json
@@ -1,8 +1,6 @@
{
"version": "1.0.0",
"mapping_files": [
- ".includes.imp",
- "boost-1.64-all-private.imp",
- "boost-1.64-all.imp"
+ ".includes.imp"
]
}
diff --git a/NEWS b/NEWS
index 4166bee..7cb305f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
patchage (1.0.9) unstable; urgency=medium
+ * Replace boost with standard C++17 facilities
* Upgrade to fmt 9.0.0
- -- David Robillard <d@drobilla.net> Tue, 16 Aug 2022 20:36:01 +0000
+ -- David Robillard <d@drobilla.net> Mon, 22 Aug 2022 17:07:17 +0000
patchage (1.0.8) stable; urgency=medium
diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build
index ea5d66e..99cb3b7 100644
--- a/meson/suppressions/meson.build
+++ b/meson/suppressions/meson.build
@@ -34,12 +34,6 @@ if is_variable('cpp')
cpp_suppressions += [
'-Wno-documentation', # JACK
'-Wno-documentation-deprecated-sync', # JACK
- '-Wno-documentation-unknown-command', # boost
- '-Wno-global-constructors', # boost
- '-Wno-old-style-cast', # boost
- '-Wno-redundant-parens', # boost
- '-Wno-reserved-id-macro', # boost
- '-Wno-zero-as-null-pointer-constant', # boost
]
endif
diff --git a/src/Action.hpp b/src/Action.hpp
index 688a73c..c791445 100644
--- a/src/Action.hpp
+++ b/src/Action.hpp
@@ -9,7 +9,7 @@
#include "Setting.hpp"
#include "SignalDirection.hpp"
-#include <boost/variant/variant.hpp>
+#include <variant>
namespace patchage {
namespace action {
@@ -68,22 +68,22 @@ struct ZoomOut {};
} // namespace action
/// A high-level action from the user
-using Action = boost::variant<action::ChangeSetting,
- action::ConnectPorts,
- action::DecreaseFontSize,
- action::DisconnectClient,
- action::DisconnectPort,
- action::DisconnectPorts,
- action::IncreaseFontSize,
- action::MoveModule,
- action::Refresh,
- action::ResetFontSize,
- action::SplitModule,
- action::UnsplitModule,
- action::ZoomFull,
- action::ZoomIn,
- action::ZoomNormal,
- action::ZoomOut>;
+using Action = std::variant<action::ChangeSetting,
+ action::ConnectPorts,
+ action::DecreaseFontSize,
+ action::DisconnectClient,
+ action::DisconnectPort,
+ action::DisconnectPorts,
+ action::IncreaseFontSize,
+ action::MoveModule,
+ action::Refresh,
+ action::ResetFontSize,
+ action::SplitModule,
+ action::UnsplitModule,
+ action::ZoomFull,
+ action::ZoomIn,
+ action::ZoomNormal,
+ action::ZoomOut>;
} // namespace patchage
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index ee52aed..83a0a48 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -22,13 +22,12 @@ PATCHAGE_RESTORE_WARNINGS
#include <alsa/asoundlib.h>
#include <pthread.h>
-#include <boost/optional/optional.hpp>
-
#include <cassert>
#include <cstdint>
#include <functional>
#include <limits>
#include <memory>
+#include <optional>
#include <set>
#include <string>
#include <utility>
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 574bb33..6dfad50 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -34,7 +34,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
PATCHAGE_RESTORE_WARNINGS
-#include <boost/optional/optional.hpp>
#include <gdk/gdkkeysyms.h>
#include <sigc++/functors/mem_fun.h>
#include <sigc++/signal.h>
@@ -42,6 +41,7 @@ PATCHAGE_RESTORE_WARNINGS
#include <cassert>
#include <cstdlib>
#include <functional>
+#include <optional>
#include <set>
#include <string>
#include <utility>
diff --git a/src/CanvasPort.hpp b/src/CanvasPort.hpp
index 594fdfb..548c9e5 100644
--- a/src/CanvasPort.hpp
+++ b/src/CanvasPort.hpp
@@ -12,7 +12,6 @@ PATCHAGE_DISABLE_GANV_WARNINGS
#include "ganv/Port.hpp"
PATCHAGE_RESTORE_WARNINGS
-#include <boost/optional/optional.hpp>
#include <gdk/gdk.h>
#include <gtkmm/menu.h>
#include <gtkmm/menu_elems.h>
@@ -22,6 +21,7 @@ PATCHAGE_RESTORE_WARNINGS
#include <sigc++/signal.h>
#include <cstdint>
+#include <optional>
#include <string>
#include <utility>
@@ -35,15 +35,15 @@ namespace patchage {
class CanvasPort : public Ganv::Port
{
public:
- CanvasPort(Ganv::Module& module,
- PortType type,
- PortID id,
- const std::string& name,
- const std::string& human_name,
- bool is_input,
- uint32_t color,
- bool show_human_name,
- boost::optional<int> order = boost::optional<int>())
+ CanvasPort(Ganv::Module& module,
+ PortType type,
+ PortID id,
+ const std::string& name,
+ const std::string& human_name,
+ bool is_input,
+ uint32_t color,
+ bool show_human_name,
+ std::optional<int> order = std::optional<int>())
: Port(module,
(show_human_name && !human_name.empty()) ? human_name : name,
is_input,
@@ -88,18 +88,18 @@ public:
return true;
}
- PortType type() const { return _type; }
- PortID id() const { return _id; }
- const std::string& name() const { return _name; }
- const std::string& human_name() const { return _human_name; }
- const boost::optional<int>& order() const { return _order; }
+ PortType type() const { return _type; }
+ PortID id() const { return _id; }
+ const std::string& name() const { return _name; }
+ const std::string& human_name() const { return _human_name; }
+ const std::optional<int>& order() const { return _order; }
private:
- PortType _type;
- PortID _id;
- std::string _name;
- std::string _human_name;
- boost::optional<int> _order;
+ PortType _type;
+ PortID _id;
+ std::string _name;
+ std::string _human_name;
+ std::optional<int> _order;
};
} // namespace patchage
diff --git a/src/Configuration.hpp b/src/Configuration.hpp
index 641d2b7..7837cd0 100644
--- a/src/Configuration.hpp
+++ b/src/Configuration.hpp
@@ -9,11 +9,10 @@
#include "Setting.hpp"
#include "SignalDirection.hpp"
-#include <boost/optional/optional.hpp>
-
#include <cstdint>
#include <functional>
#include <map>
+#include <optional>
#include <string>
#include <tuple>
@@ -113,10 +112,10 @@ private:
: split(s)
{}
- boost::optional<Coord> input_location;
- boost::optional<Coord> output_location;
- boost::optional<Coord> inout_location;
- bool split;
+ std::optional<Coord> input_location;
+ std::optional<Coord> output_location;
+ std::optional<Coord> inout_location;
+ bool split;
};
std::map<std::string, ModuleSettings> _module_settings;
diff --git a/src/Event.hpp b/src/Event.hpp
index 0ad6b44..36166e7 100644
--- a/src/Event.hpp
+++ b/src/Event.hpp
@@ -10,7 +10,7 @@
#include "PortID.hpp"
#include "PortInfo.hpp"
-#include <boost/variant/variant.hpp>
+#include <variant>
namespace patchage {
namespace event {
@@ -56,15 +56,15 @@ struct PortsDisconnected {
} // namespace event
/// An event from drivers that represents a change to the system
-using Event = boost::variant<event::Cleared,
- event::ClientCreated,
- event::ClientDestroyed,
- event::DriverAttached,
- event::DriverDetached,
- event::PortCreated,
- event::PortDestroyed,
- event::PortsConnected,
- event::PortsDisconnected>;
+using Event = std::variant<event::Cleared,
+ event::ClientCreated,
+ event::ClientDestroyed,
+ event::DriverAttached,
+ event::DriverDetached,
+ event::PortCreated,
+ event::PortDestroyed,
+ event::PortsConnected,
+ event::PortsDisconnected>;
} // namespace patchage
diff --git a/src/JackLibDriver.cpp b/src/JackLibDriver.cpp
index b519d7b..2813a92 100644
--- a/src/JackLibDriver.cpp
+++ b/src/JackLibDriver.cpp
@@ -26,7 +26,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
PATCHAGE_RESTORE_WARNINGS
-#include <boost/optional/optional.hpp>
#include <jack/jack.h>
#include <jack/types.h>
@@ -35,6 +34,7 @@ PATCHAGE_RESTORE_WARNINGS
#include <functional>
#include <memory>
#include <mutex>
+#include <optional>
#include <set>
#include <string>
#include <unordered_set>
@@ -230,8 +230,8 @@ JackLibDriver::get_port_info(const jack_port_t* const port)
: SignalDirection::output);
// Get port order from metadata if possible
- boost::optional<int> order;
- const std::string order_str = get_property(uuid, JACKEY_ORDER);
+ std::optional<int> order;
+ const std::string order_str = get_property(uuid, JACKEY_ORDER);
if (!order_str.empty()) {
order = std::stoi(order_str);
}
diff --git a/src/Metadata.cpp b/src/Metadata.cpp
index aa60582..929b090 100644
--- a/src/Metadata.cpp
+++ b/src/Metadata.cpp
@@ -8,13 +8,12 @@
#include "PortID.hpp"
#include "PortInfo.hpp"
-#include <boost/optional/optional.hpp>
-
+#include <optional>
#include <utility>
namespace patchage {
-boost::optional<ClientInfo>
+std::optional<ClientInfo>
Metadata::client(const ClientID& id) const
{
const auto i = _client_data.find(id);
@@ -25,7 +24,7 @@ Metadata::client(const ClientID& id) const
return i->second;
}
-boost::optional<PortInfo>
+std::optional<PortInfo>
Metadata::port(const PortID& id) const
{
const auto i = _port_data.find(id);
diff --git a/src/Metadata.hpp b/src/Metadata.hpp
index 15d9672..520b0ce 100644
--- a/src/Metadata.hpp
+++ b/src/Metadata.hpp
@@ -9,9 +9,8 @@
#include "PortID.hpp"
#include "PortInfo.hpp"
-#include <boost/optional/optional.hpp>
-
#include <map>
+#include <optional>
namespace patchage {
@@ -21,8 +20,8 @@ class Metadata
public:
Metadata() = default;
- boost::optional<ClientInfo> client(const ClientID& id) const;
- boost::optional<PortInfo> port(const PortID& id) const;
+ std::optional<ClientInfo> client(const ClientID& id) const;
+ std::optional<PortInfo> port(const PortID& id) const;
void set_client(const ClientID& id, const ClientInfo& info);
void set_port(const PortID& id, const PortInfo& info);
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 96af631..1f3d706 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -39,9 +39,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
PATCHAGE_RESTORE_WARNINGS
-#include <boost/optional/optional.hpp>
-#include <boost/variant/apply_visitor.hpp>
-#include <boost/variant/variant.hpp>
#include <glib-object.h>
#include <glib.h>
#include <glibmm/fileutils.h>
@@ -95,7 +92,9 @@ PATCHAGE_RESTORE_WARNINGS
#include <cstdlib>
#include <functional>
#include <map>
+#include <optional>
#include <utility>
+#include <variant>
#ifdef PATCHAGE_GTK_OSX
@@ -769,7 +768,7 @@ Patchage::process_events()
void
Patchage::on_conf_change(const Setting& setting)
{
- boost::apply_visitor(*this, setting);
+ std::visit(*this, setting);
}
void
diff --git a/src/PortInfo.hpp b/src/PortInfo.hpp
index 860d1db..b6d88b5 100644
--- a/src/PortInfo.hpp
+++ b/src/PortInfo.hpp
@@ -7,18 +7,18 @@
#include "PortType.hpp"
#include "SignalDirection.hpp"
-#include <boost/optional/optional.hpp>
+#include <optional>
#include <string>
namespace patchage {
/// Extra information about a port not expressed in its ID
struct PortInfo {
- std::string label; ///< Human-friendly label
- PortType type; ///< Detailed port type
- SignalDirection direction; ///< Signal direction
- boost::optional<int> order; ///< Order key on client
- bool is_terminal; ///< True if this is a system port
+ std::string label; ///< Human-friendly label
+ PortType type; ///< Detailed port type
+ SignalDirection direction; ///< Signal direction
+ std::optional<int> order; ///< Order key on client
+ bool is_terminal; ///< True if this is a system port
};
} // namespace patchage
diff --git a/src/Reactor.cpp b/src/Reactor.cpp
index 3c634ab..44bca82 100644
--- a/src/Reactor.cpp
+++ b/src/Reactor.cpp
@@ -24,15 +24,13 @@ PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
PATCHAGE_RESTORE_WARNINGS
-#include <boost/variant/apply_visitor.hpp>
+#include <variant>
namespace patchage {
class SettingVisitor
{
public:
- using result_type = void; ///< For boost::apply_visitor
-
explicit SettingVisitor(Configuration& conf)
: _conf{conf}
{}
@@ -61,7 +59,7 @@ void
Reactor::operator()(const action::ChangeSetting& action)
{
SettingVisitor visitor{_conf};
- boost::apply_visitor(visitor, action.setting);
+ std::visit(visitor, action.setting);
}
void
@@ -185,7 +183,7 @@ Reactor::operator()(const action::ZoomOut&)
void
Reactor::operator()(const Action& action)
{
- boost::apply_visitor(*this, action);
+ std::visit(*this, action);
}
std::string
diff --git a/src/Reactor.hpp b/src/Reactor.hpp
index 74af8b7..74b1a07 100644
--- a/src/Reactor.hpp
+++ b/src/Reactor.hpp
@@ -25,8 +25,6 @@ class ILog;
class Reactor
{
public:
- using result_type = void; ///< For boost::apply_visitor
-
explicit Reactor(Configuration& conf,
Drivers& drivers,
Canvas& canvas,
diff --git a/src/Setting.hpp b/src/Setting.hpp
index 1e1aa6f..4bcfc81 100644
--- a/src/Setting.hpp
+++ b/src/Setting.hpp
@@ -7,9 +7,8 @@
#include "Coord.hpp"
#include "PortType.hpp"
-#include <boost/variant/variant.hpp>
-
#include <cstdint>
+#include <variant>
namespace patchage {
namespace setting {
@@ -70,19 +69,19 @@ struct Zoom {
} // namespace setting
/// A configuration setting
-using Setting = boost::variant<setting::AlsaAttached,
- setting::FontSize,
- setting::HumanNames,
- setting::JackAttached,
- setting::MessagesHeight,
- setting::MessagesVisible,
- setting::PortColor,
- setting::SortedPorts,
- setting::SprungLayout,
- setting::ToolbarVisible,
- setting::WindowLocation,
- setting::WindowSize,
- setting::Zoom>;
+using Setting = std::variant<setting::AlsaAttached,
+ setting::FontSize,
+ setting::HumanNames,
+ setting::JackAttached,
+ setting::MessagesHeight,
+ setting::MessagesVisible,
+ setting::PortColor,
+ setting::SortedPorts,
+ setting::SprungLayout,
+ setting::ToolbarVisible,
+ setting::WindowLocation,
+ setting::WindowSize,
+ setting::Zoom>;
} // namespace patchage
diff --git a/src/event_to_string.cpp b/src/event_to_string.cpp
index dc14a4d..1f32ce6 100644
--- a/src/event_to_string.cpp
+++ b/src/event_to_string.cpp
@@ -17,18 +17,15 @@ PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
PATCHAGE_RESTORE_WARNINGS
-#include <boost/optional/optional.hpp>
-#include <boost/variant/apply_visitor.hpp>
-
+#include <optional>
#include <string>
+#include <variant>
namespace patchage {
namespace {
struct EventPrinter {
- using result_type = std::string; ///< For boost::apply_visitor
-
std::string operator()(const ClientType type)
{
switch (type) {
@@ -101,7 +98,7 @@ std::string
event_to_string(const Event& event)
{
EventPrinter printer;
- return boost::apply_visitor(printer, event);
+ return std::visit(printer, event);
}
std::ostream&
diff --git a/src/handle_event.cpp b/src/handle_event.cpp
index 710c4af..d75c42d 100644
--- a/src/handle_event.cpp
+++ b/src/handle_event.cpp
@@ -18,7 +18,7 @@ PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
PATCHAGE_RESTORE_WARNINGS
-#include <boost/variant/apply_visitor.hpp>
+#include <variant>
namespace patchage {
@@ -27,8 +27,6 @@ namespace {
class EventHandler
{
public:
- using result_type = void; ///< For boost::apply_visitor
-
explicit EventHandler(Configuration& conf,
Metadata& metadata,
Canvas& canvas,
@@ -145,7 +143,7 @@ handle_event(Configuration& conf,
const Event& event)
{
EventHandler handler{conf, metadata, canvas, log};
- boost::apply_visitor(handler, event);
+ std::visit(handler, event);
}
} // namespace patchage