MIDI plugins -- partial implemetnation, temporarily disabled.

This commit is contained in:
Robin E. R. Davies
2024-12-05 10:52:34 -05:00
parent 2989309728
commit 9d64cf1f92
24 changed files with 892 additions and 84 deletions
+26
View File
@@ -34,6 +34,7 @@
#include <limits>
#include <stdexcept>
#include <chrono>
#include <optional>
#define DECLARE_JSON_MAP(CLASSNAME) \
static pipedal::json_map::storage_type<CLASSNAME> jmap
@@ -592,6 +593,17 @@ namespace pipedal
write(obj.get());
}
}
template <typename T>
void write(const std::optional<T> &obj)
{
if (!obj) {
write_raw("null");
} else {
write(obj.get());
}
}
template <typename T>
void write(const std::weak_ptr<T> &obj)
{
@@ -883,6 +895,20 @@ namespace pipedal
}
}
template <typename T>
void read(std::optional<T> *pOptional)
{
if (peek() == 'n')
{
consumeToken("null", "Expecting '{' or 'null'.");
*pOptional = std::optional<T>();
} else {
T value;
read(&value);
*pOptional = std::move(value);
}
}
template <typename T>
void read(std::weak_ptr<T> *pUniquePtr)
{
throw std::domain_error("Can't read std::weak_ptr");