summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-27 17:58:12 +0100
committerDavid Robillard <d@drobilla.net>2020-11-27 21:42:52 +0100
commit7c991383000520d03acfb7a1adfd834dd7c8e35e (patch)
tree4a80722b54b6e6192a67adaf43f0e1105adaf5b2 /src
parent96b68f0c39b02b41f96245cedcc156c60c3317e2 (diff)
downloadpatchage-7c991383000520d03acfb7a1adfd834dd7c8e35e.tar.gz
patchage-7c991383000520d03acfb7a1adfd834dd7c8e35e.tar.bz2
patchage-7c991383000520d03acfb7a1adfd834dd7c8e35e.zip
Replace boost::format with fmt
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp17
-rw-r--r--src/JackDbusDriver.cpp50
-rw-r--r--src/JackDriver.cpp23
-rw-r--r--src/Patchage.cpp7
-rw-r--r--src/PatchageCanvas.cpp4
-rw-r--r--src/PatchageEvent.cpp26
-rw-r--r--src/warnings.hpp9
7 files changed, 71 insertions, 65 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index a705558..fc8fd34 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -21,15 +21,15 @@
#include "PatchageModule.hpp"
#include "PatchagePort.hpp"
-#include <boost/format.hpp>
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+PATCHAGE_RESTORE_WARNINGS
#include <cassert>
#include <set>
#include <string>
#include <utility>
-using boost::format;
-
AlsaDriver::AlsaDriver(Patchage* app)
: _app(app)
, _seq(nullptr)
@@ -427,8 +427,7 @@ AlsaDriver::connect(PatchagePort* src_port, PatchagePort* dst_port)
int ret = snd_seq_subscribe_port(_seq, subs);
if (ret < 0) {
_app->error_msg(
- (format("Alsa: Subscription failed (%1%).") % snd_strerror(ret))
- .str());
+ fmt::format("Alsa: Subscription failed ({}).", snd_strerror(ret)));
result = false;
}
@@ -505,8 +504,7 @@ AlsaDriver::create_refresh_port()
int ret = snd_seq_create_port(_seq, port_info);
if (ret) {
_app->error_msg(
- (format("Alsa: Error creating port (%1%): ") % snd_strerror(ret))
- .str());
+ fmt::format("Alsa: Error creating port ({})", snd_strerror(ret)));
return false;
}
@@ -517,9 +515,8 @@ AlsaDriver::create_refresh_port()
SND_SEQ_PORT_SYSTEM_ANNOUNCE);
if (ret) {
_app->error_msg(
- (format("Alsa: Failed to connect to system announce port (%1%)") %
- snd_strerror(ret))
- .str());
+ fmt::format("Alsa: Failed to connect to system announce port ({})",
+ snd_strerror(ret)));
return false;
}
diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp
index 926b058..5fb9d43 100644
--- a/src/JackDbusDriver.cpp
+++ b/src/JackDbusDriver.cpp
@@ -25,7 +25,10 @@
#include "PatchageEvent.hpp"
#include "PatchageModule.hpp"
-#include <boost/format.hpp>
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+PATCHAGE_RESTORE_WARNINGS
+
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus.h>
@@ -174,9 +177,10 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/,
&new_owner,
DBUS_TYPE_INVALID)) {
me->error_msg(
- str(boost::format("dbus_message_get_args() failed to extract "
- "NameOwnerChanged signal arguments (%s)") %
- me->_dbus_error.message));
+ fmt::format("dbus_message_get_args() failed to extract "
+ "NameOwnerChanged signal arguments ({})",
+ me->_dbus_error.message));
+
dbus_error_free(&me->_dbus_error);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -197,9 +201,9 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/,
&new_graph_version,
DBUS_TYPE_INVALID)) {
me->error_msg(
- str(boost::format("dbus_message_get_args() failed to extract "
- "GraphChanged signal arguments (%s)") %
- me->_dbus_error.message));
+ fmt::format("dbus_message_get_args() failed to extract "
+ "GraphChanged signal arguments ({})",
+ me->_dbus_error.message));
dbus_error_free(&me->_dbus_error);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -236,9 +240,9 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/,
&port_type,
DBUS_TYPE_INVALID)) {
me->error_msg(
- str(boost::format("dbus_message_get_args() failed to extract "
- "PortAppeared signal arguments (%s)") %
- me->_dbus_error.message));
+ fmt::format("dbus_message_get_args() failed to extract "
+ "PortAppeared signal arguments ({})",
+ me->_dbus_error.message));
dbus_error_free(&me->_dbus_error);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -270,9 +274,9 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/,
&port_name,
DBUS_TYPE_INVALID)) {
me->error_msg(
- str(boost::format("dbus_message_get_args() failed to extract "
- "PortDisappeared signal arguments (%s)") %
- me->_dbus_error.message));
+ fmt::format("dbus_message_get_args() failed to extract "
+ "PortDisappeared signal arguments ({})",
+ me->_dbus_error.message));
dbus_error_free(&me->_dbus_error);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -313,9 +317,9 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/,
&connection_id,
DBUS_TYPE_INVALID)) {
me->error_msg(
- str(boost::format("dbus_message_get_args() failed to extract "
- "PortsConnected signal arguments (%s)") %
- me->_dbus_error.message));
+ fmt::format("dbus_message_get_args() failed to extract "
+ "PortsConnected signal arguments ({})",
+ me->_dbus_error.message));
dbus_error_free(&me->_dbus_error);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -364,9 +368,9 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/,
&connection_id,
DBUS_TYPE_INVALID)) {
me->error_msg(
- str(boost::format("dbus_message_get_args() failed to extract "
- "PortsConnected signal arguments (%s)") %
- me->_dbus_error.message));
+ fmt::format("dbus_message_get_args() failed to extract "
+ "PortsDisconnected signal arguments ({})",
+ me->_dbus_error.message));
dbus_error_free(&me->_dbus_error);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -428,10 +432,10 @@ JackDriver::call(bool response_expected,
if (!reply_ptr) {
if (response_expected) {
- error_msg(str(
- boost::format("no reply from server when calling method '%s'"
- ", error is '%s'") %
- method % _dbus_error.message));
+ error_msg(
+ fmt::format("no reply from server when calling method {} ({})",
+ method,
+ _dbus_error.message));
}
_server_responding = false;
dbus_error_free(&_dbus_error);
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index 47996e0..29fedd8 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -28,7 +28,10 @@
# include <jack/metadata.h>
#endif
-#include <boost/format.hpp>
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+PATCHAGE_RESTORE_WARNINGS
+
#include <jack/jack.h>
#include <jack/statistics.h>
@@ -37,8 +40,6 @@
#include <set>
#include <string>
-using boost::format;
-
JackDriver::JackDriver(Patchage* app)
: _app(app)
, _client(nullptr)
@@ -140,8 +141,8 @@ JackDriver::create_port_view(Patchage* patchage, const PortID& id)
jack_port_t* jack_port = jack_port_by_id(_client, id.id.jack_id);
if (!jack_port) {
- _app->error_msg(
- (format("Jack: Failed to find port with ID `%1%'.") % id).str());
+ _app->error_msg(fmt::format("Jack: Failed to find port with ID `{}'.",
+ id.id.jack_id));
return nullptr;
}
@@ -169,9 +170,9 @@ JackDriver::create_port_view(Patchage* patchage, const PortID& id)
}
if (parent->get_port(port_name)) {
- _app->error_msg((format("Jack: Module `%1%' already has port `%2%'.") %
- module_name % port_name)
- .str());
+ _app->error_msg(fmt::format("Jack: Module `{}' already has port `{}'.",
+ module_name,
+ port_name));
return nullptr;
}
@@ -242,9 +243,9 @@ JackDriver::create_port(PatchageModule& parent,
}
#endif
} else {
- _app->warning_msg((format("Jack: Port `%1%' has unknown type `%2%'.") %
- jack_port_name(port) % type_str)
- .str());
+ _app->warning_msg(fmt::format("Jack: Port `{}' has unknown type `{}'.",
+ jack_port_name(port),
+ type_str));
return nullptr;
}
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index b5e9bbf..6a40c20 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -44,7 +44,10 @@ PATCHAGE_DISABLE_GANV_WARNINGS
#include "ganv/Module.hpp"
PATCHAGE_RESTORE_WARNINGS
-#include <boost/format.hpp>
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+PATCHAGE_RESTORE_WARNINGS
+
#include <glib.h>
#include <glib/gstdio.h>
#include <gtk/gtkwindow.h>
@@ -343,7 +346,7 @@ Patchage::Patchage(int argc, char** argv)
_about_win->set_logo(Gdk::Pixbuf::create_from_file(
bundle_location() + "/Resources/Patchage.icns"));
} catch (const Glib::Exception& e) {
- error_msg((boost::format("failed to set logo (%s)") % e.what()).str());
+ error_msg(fmt::format("failed to set logo ({})", e.what()));
}
#endif
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp
index 214c158..b6a592f 100644
--- a/src/PatchageCanvas.cpp
+++ b/src/PatchageCanvas.cpp
@@ -36,10 +36,6 @@ PATCHAGE_DISABLE_GANV_WARNINGS
#include "ganv/Edge.hpp"
PATCHAGE_RESTORE_WARNINGS
-#include <boost/format.hpp>
-
-using boost::format;
-
PatchageCanvas::PatchageCanvas(Patchage* app, int width, int height)
: Ganv::Canvas(width, height)
, _app(app)
diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp
index bb8e057..4df2924 100644
--- a/src/PatchageEvent.cpp
+++ b/src/PatchageEvent.cpp
@@ -32,9 +32,10 @@
# include "AlsaDriver.hpp"
#endif
-#include <boost/format.hpp>
-
-using boost::format;
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+#include <fmt/ostream.h>
+PATCHAGE_RESTORE_WARNINGS
void
PatchageEvent::execute(Patchage* patchage)
@@ -68,13 +69,12 @@ PatchageEvent::execute(Patchage* patchage)
if (driver) {
PatchagePort* port = driver->create_port_view(patchage, _port_1);
if (!port) {
- patchage->error_msg(
- (format("Unable to create view for port `%1%'") % _port_1)
- .str());
+ patchage->error_msg(fmt::format(
+ "Unable to create view for port `{}'", _port_1));
}
} else {
patchage->error_msg(
- (format("Unknown type for port `%1%'") % _port_1).str());
+ fmt::format("Unknown type for port `{}'", _port_1));
}
} else if (_type == Type::port_destruction) {
@@ -88,12 +88,10 @@ PatchageEvent::execute(Patchage* patchage)
if (!port_1) {
patchage->error_msg(
- (format("Unable to find port `%1%' to connect") % _port_1)
- .str());
+ fmt::format("Unable to find port `{}' to connect", _port_1));
} else if (!port_2) {
patchage->error_msg(
- (format("Unable to find port `%1%' to connect") % _port_2)
- .str());
+ fmt::format("Unable to find port `{}' to connect", _port_2));
} else {
patchage->canvas()->make_connection(port_1, port_2);
}
@@ -105,12 +103,10 @@ PatchageEvent::execute(Patchage* patchage)
if (!port_1) {
patchage->error_msg(
- (format("Unable to find port `%1%' to disconnect") % _port_1)
- .str());
+ fmt::format("Unable to find port `{}' to disconnect", _port_1));
} else if (!port_2) {
patchage->error_msg(
- (format("Unable to find port `%1%' to disconnect") % _port_2)
- .str());
+ fmt::format("Unable to find port `{}' to disconnect", _port_2));
} else {
patchage->canvas()->remove_edge_between(port_1, port_2);
}
diff --git a/src/warnings.hpp b/src/warnings.hpp
index df711f0..31cdf42 100644
--- a/src/warnings.hpp
+++ b/src/warnings.hpp
@@ -19,6 +19,13 @@
#if defined(__clang__)
+# define PATCHAGE_DISABLE_FMT_WARNINGS \
+ _Pragma("clang diagnostic push") \
+ _Pragma( \
+ "clang diagnostic ignored \"-Wdocumentation-unknown-command\"") \
+ _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \
+ _Pragma("clang diagnostic ignored \"-Wsigned-enum-bitfield\"")
+
# define PATCHAGE_DISABLE_GANV_WARNINGS \
_Pragma("clang diagnostic push") \
_Pragma( \
@@ -31,6 +38,8 @@
#elif defined(__GNUC__)
+# define PATCHAGE_DISABLE_FMT_WARNINGS _Pragma("GCC diagnostic push")
+
# define PATCHAGE_DISABLE_GANV_WARNINGS \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wsuggest-override\"") \