From a77e2fbfae65e9ca86946ee9732f58dcdcdcba7e Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 5 Dec 2020 02:33:11 +0100 Subject: [PATCH] Add Bitsery serialization for FUIDs --- src/common/bitsery/ext/vst3.h | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/common/bitsery/ext/vst3.h diff --git a/src/common/bitsery/ext/vst3.h b/src/common/bitsery/ext/vst3.h new file mode 100644 index 00000000..458c66cd --- /dev/null +++ b/src/common/bitsery/ext/vst3.h @@ -0,0 +1,63 @@ +// yabridge: a Wine VST bridge +// Copyright (C) 2020 Robbert van der Helm +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once + +#include + +#include +#include +#include + +namespace bitsery { +namespace ext { + +/** + * An adapter for serializing and deserializing `Steinberg::FUID`s. + */ +class FUID { + public: + template + void serialize(Ser& ser, const Steinberg::FUID& uid, Fnc&&) const { + Steinberg::FUID::String uid_str; + uid.toString(uid_str); + + ser.text1b(uid_str); + } + + template + void deserialize(Des& des, Steinberg::FUID& uid, Fnc&&) const { + Steinberg::FUID::String uid_str; + des.text1b(uid_str); + + uid.fromString(uid_str); + } +}; + +} // namespace ext + +namespace traits { + +template <> +struct ExtensionTraits { + using TValue = void; + static constexpr bool SupportValueOverload = false; + static constexpr bool SupportObjectOverload = true; + static constexpr bool SupportLambdaOverload = false; +}; + +} // namespace traits +} // namespace bitsery