summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-16 16:44:29 -0400
committerDavid Robillard <d@drobilla.net>2022-08-16 16:44:29 -0400
commit3e5cf3400273b0e4f8f96a3a87d2b9e57574eeec (patch)
treecee5b7cd84248dea488653ca874b40dd8b53c06d /src
parent66e0bb76b40311245b9c59e2f3167e4e98027eba (diff)
downloadpatchage-3e5cf3400273b0e4f8f96a3a87d2b9e57574eeec.tar.gz
patchage-3e5cf3400273b0e4f8f96a3a87d2b9e57574eeec.tar.bz2
patchage-3e5cf3400273b0e4f8f96a3a87d2b9e57574eeec.zip
Upgrade to fmt 9.0.0
This library tends to break in annoying ways like this, so pin the major version to 9 to hopefully avoid these problems in the future.
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp1
-rw-r--r--src/Canvas.cpp1
-rw-r--r--src/ClientID.hpp9
-rw-r--r--src/ClientType.hpp25
-rw-r--r--src/Configuration.cpp2
-rw-r--r--src/JackDbusDriver.cpp1
-rw-r--r--src/PortID.hpp3
-rw-r--r--src/PortType.hpp31
-rw-r--r--src/Reactor.cpp18
-rw-r--r--src/SignalDirection.hpp27
-rw-r--r--src/event_to_string.cpp38
-rw-r--r--src/handle_event.cpp1
12 files changed, 100 insertions, 57 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index fbe7779..ee52aed 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -17,7 +17,6 @@
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
-#include <fmt/ostream.h> // IWYU pragma: keep
PATCHAGE_RESTORE_WARNINGS
#include <alsa/asoundlib.h>
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 9b7760a..574bb33 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -32,7 +32,6 @@ PATCHAGE_RESTORE_WARNINGS
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
-#include <fmt/ostream.h> // IWYU pragma: keep
PATCHAGE_RESTORE_WARNINGS
#include <boost/optional/optional.hpp>
diff --git a/src/ClientID.hpp b/src/ClientID.hpp
index 9d4c361..d73e45e 100644
--- a/src/ClientID.hpp
+++ b/src/ClientID.hpp
@@ -5,6 +5,12 @@
#define PATCHAGE_CLIENTID_HPP
#include "ClientType.hpp"
+#include "warnings.hpp"
+
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+#include <fmt/ostream.h>
+PATCHAGE_RESTORE_WARNINGS
#include <cassert>
#include <cstdint>
@@ -111,4 +117,7 @@ operator<(const ClientID& lhs, const ClientID& rhs)
} // namespace patchage
+template<>
+struct fmt::formatter<patchage::ClientID> : fmt::ostream_formatter {};
+
#endif // PATCHAGE_CLIENTID_HPP
diff --git a/src/ClientType.hpp b/src/ClientType.hpp
index 0812aa0..7a3f87a 100644
--- a/src/ClientType.hpp
+++ b/src/ClientType.hpp
@@ -4,6 +4,15 @@
#ifndef PATCHAGE_CLIENTTYPE_HPP
#define PATCHAGE_CLIENTTYPE_HPP
+#include "warnings.hpp"
+
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+#include <fmt/ostream.h>
+PATCHAGE_RESTORE_WARNINGS
+
+#include <ostream>
+
namespace patchage {
/// A type of client (program) with supported ports
@@ -12,6 +21,22 @@ enum class ClientType {
alsa,
};
+inline std::ostream&
+operator<<(std::ostream& os, const ClientType type)
+{
+ switch (type) {
+ case ClientType::jack:
+ return os << "JACK";
+ case ClientType::alsa:
+ return os << "ALSA";
+ }
+
+ return os;
+}
+
} // namespace patchage
+template<>
+struct fmt::formatter<patchage::ClientType> : fmt::ostream_formatter {};
+
#endif // PATCHAGE_CLIENTTYPE_HPP
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index fb53116..6490a88 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -18,6 +18,8 @@
#include <utility>
#include <vector>
+// IWYU pragma: no_include <algorithm>
+
namespace patchage {
static const char* const port_type_names[N_PORT_TYPES] = {"JACK_AUDIO",
diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp
index 22e64b5..81aca11 100644
--- a/src/JackDbusDriver.cpp
+++ b/src/JackDbusDriver.cpp
@@ -15,7 +15,6 @@
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
-#include <fmt/ostream.h> // IWYU pragma: keep
PATCHAGE_RESTORE_WARNINGS
#include <dbus/dbus-glib-lowlevel.h>
diff --git a/src/PortID.hpp b/src/PortID.hpp
index 3c2fc58..54e4c5d 100644
--- a/src/PortID.hpp
+++ b/src/PortID.hpp
@@ -172,4 +172,7 @@ struct hash<patchage::PortID::Type> {
} // namespace std
+template<>
+struct fmt::formatter<patchage::PortID> : fmt::ostream_formatter {};
+
#endif // PATCHAGE_PORTID_HPP
diff --git a/src/PortType.hpp b/src/PortType.hpp
index ec322b7..97ecaab 100644
--- a/src/PortType.hpp
+++ b/src/PortType.hpp
@@ -4,6 +4,15 @@
#ifndef PATCHAGE_PORTTYPE_HPP
#define PATCHAGE_PORTTYPE_HPP
+#include "warnings.hpp"
+
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+#include <fmt/ostream.h>
+PATCHAGE_RESTORE_WARNINGS
+
+#include <ostream>
+
namespace patchage {
enum class PortType {
@@ -14,6 +23,28 @@ enum class PortType {
jack_cv,
};
+inline std::ostream&
+operator<<(std::ostream& os, const PortType port_type)
+{
+ switch (port_type) {
+ case PortType::jack_audio:
+ return os << "JACK audio";
+ case PortType::jack_midi:
+ return os << "JACK MIDI";
+ case PortType::alsa_midi:
+ return os << "ALSA MIDI";
+ case PortType::jack_osc:
+ return os << "JACK OSC";
+ case PortType::jack_cv:
+ return os << "JACK CV";
+ }
+
+ PATCHAGE_UNREACHABLE();
+}
+
} // namespace patchage
+template<>
+struct fmt::formatter<patchage::PortType> : fmt::ostream_formatter {};
+
#endif // PATCHAGE_PORTTYPE_HPP
diff --git a/src/Reactor.cpp b/src/Reactor.cpp
index f72086d..3c634ab 100644
--- a/src/Reactor.cpp
+++ b/src/Reactor.cpp
@@ -22,13 +22,10 @@
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
-#include <fmt/ostream.h> // IWYU pragma: keep
PATCHAGE_RESTORE_WARNINGS
#include <boost/variant/apply_visitor.hpp>
-#include <ostream>
-
namespace patchage {
class SettingVisitor
@@ -50,19 +47,6 @@ private:
Configuration& _conf;
};
-inline std::ostream&
-operator<<(std::ostream& os, const ClientType type)
-{
- switch (type) {
- case ClientType::jack:
- return os << "JACK";
- case ClientType::alsa:
- return os << "ALSA";
- }
-
- return os;
-}
-
Reactor::Reactor(Configuration& conf,
Drivers& drivers,
Canvas& canvas,
@@ -127,7 +111,7 @@ Reactor::operator()(const action::DisconnectPorts& action)
if (auto* d = _drivers.driver(action.tail.type())) {
d->disconnect(action.tail, action.head);
} else {
- _log.error(fmt::format("No driver for {}", action.tail.type()));
+ _log.error(fmt::format("No driver available to disconnect ports"));
}
} else {
_log.error("Unable to disconnect incompatible ports");
diff --git a/src/SignalDirection.hpp b/src/SignalDirection.hpp
index 3d499a4..84c3cc2 100644
--- a/src/SignalDirection.hpp
+++ b/src/SignalDirection.hpp
@@ -4,6 +4,15 @@
#ifndef PATCHAGE_SIGNALDIRECTION_HPP
#define PATCHAGE_SIGNALDIRECTION_HPP
+#include "warnings.hpp"
+
+PATCHAGE_DISABLE_FMT_WARNINGS
+#include <fmt/core.h>
+#include <fmt/ostream.h>
+PATCHAGE_RESTORE_WARNINGS
+
+#include <ostream>
+
namespace patchage {
enum class SignalDirection {
@@ -12,6 +21,24 @@ enum class SignalDirection {
duplex,
};
+inline std::ostream&
+operator<<(std::ostream& os, const SignalDirection direction)
+{
+ switch (direction) {
+ case SignalDirection::input:
+ return os << "input";
+ case SignalDirection::output:
+ return os << "output";
+ case SignalDirection::duplex:
+ return os << "duplex";
+ }
+
+ PATCHAGE_UNREACHABLE();
+}
+
} // namespace patchage
+template<>
+struct fmt::formatter<patchage::SignalDirection> : fmt::ostream_formatter {};
+
#endif // PATCHAGE_SIGNALDIRECTION_HPP
diff --git a/src/event_to_string.cpp b/src/event_to_string.cpp
index 366859a..dc14a4d 100644
--- a/src/event_to_string.cpp
+++ b/src/event_to_string.cpp
@@ -15,13 +15,11 @@
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
-#include <fmt/ostream.h> // IWYU pragma: keep
PATCHAGE_RESTORE_WARNINGS
#include <boost/optional/optional.hpp>
#include <boost/variant/apply_visitor.hpp>
-#include <ostream> // IWYU pragma: keep
#include <string>
namespace patchage {
@@ -65,44 +63,12 @@ struct EventPrinter {
return fmt::format(R"(Remove client "{}")", event.id);
}
- std::string operator()(const PortType port_type)
- {
- switch (port_type) {
- case PortType::jack_audio:
- return "JACK audio";
- case PortType::jack_midi:
- return "JACK MIDI";
- case PortType::alsa_midi:
- return "ALSA MIDI";
- case PortType::jack_osc:
- return "JACK OSC";
- case PortType::jack_cv:
- return "JACK CV";
- }
-
- PATCHAGE_UNREACHABLE();
- }
-
- std::string operator()(const SignalDirection direction)
- {
- switch (direction) {
- case SignalDirection::input:
- return "input";
- case SignalDirection::output:
- return "output";
- case SignalDirection::duplex:
- return "duplex";
- }
-
- PATCHAGE_UNREACHABLE();
- }
-
std::string operator()(const event::PortCreated& event)
{
auto result = fmt::format(R"(Add{} {} {} port "{}" ("{}"))",
event.info.is_terminal ? " terminal" : "",
- (*this)(event.info.type),
- (*this)(event.info.direction),
+ event.info.type,
+ event.info.direction,
event.id,
event.info.label);
diff --git a/src/handle_event.cpp b/src/handle_event.cpp
index d5d8ed7..710c4af 100644
--- a/src/handle_event.cpp
+++ b/src/handle_event.cpp
@@ -16,7 +16,6 @@
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
-#include <fmt/ostream.h> // IWYU pragma: keep
PATCHAGE_RESTORE_WARNINGS
#include <boost/variant/apply_visitor.hpp>