From c0c2a61f036e1e91815f73afcdb40af13afbe469 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 10 Sep 2022 18:00:44 +0200 Subject: [PATCH] Move PrimitiveWrapper to serialization common --- src/common/serialization/common.h | 22 ++++++++++++++++++++++ src/common/serialization/vst3/base.h | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/common/serialization/common.h b/src/common/serialization/common.h index f983ecee..c08f8358 100644 --- a/src/common/serialization/common.h +++ b/src/common/serialization/common.h @@ -44,6 +44,28 @@ struct Ack { void serialize(S&) {} }; +/** + * A simple wrapper around primitive values for serialization purposes. Bitsery + * doesn't seem to like serializing plain primitives using `s.object()` even if + * you define a serialization function. + */ +template +class PrimitiveWrapper { + public: + PrimitiveWrapper() noexcept {} + PrimitiveWrapper(T value) noexcept : value_(value) {} + + operator T() const noexcept { return value_; } + + template + void serialize(S& s) { + s.template value(value_); + } + + private: + T value_; +}; + /** * Marker struct to indicate the other side (the plugin) should send a copy of * the configuration. During this process we will also transmit the version diff --git a/src/common/serialization/vst3/base.h b/src/common/serialization/vst3/base.h index 4534e23e..17fd0747 100644 --- a/src/common/serialization/vst3/base.h +++ b/src/common/serialization/vst3/base.h @@ -142,28 +142,6 @@ class NativeUID { ArrayUID uid_; }; -/** - * A simple wrapper around primitive values for serialization purposes. Bitsery - * doesn't seem to like serializing plain primitives using `s.object()` even if - * you define a serialization function. - */ -template -class PrimitiveWrapper { - public: - PrimitiveWrapper() noexcept {} - PrimitiveWrapper(T value) noexcept : value_(value) {} - - operator T() const noexcept { return value_; } - - template - void serialize(S& s) { - s.template value(value_); - } - - private: - T value_; -}; - /** * A wrapper around `Steinberg::tresult` that we can safely share between the * native plugin and the Wine process. Depending on the platform and on whether