Use std::array for serializing UIDs

These are easily assignable and we have to convert between char
pointers, char arrays and UID objects all the time anyways.
This commit is contained in:
Robbert van der Helm
2020-12-08 23:00:44 +01:00
parent 7828fc7bef
commit 2e6184171c
4 changed files with 47 additions and 8 deletions
+36
View File
@@ -0,0 +1,36 @@
// 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 <https://www.gnu.org/licenses/>.
#pragma once
#include <array>
#include <pluginterfaces/base/ftypes.h>
#include <pluginterfaces/base/funknown.h>
// Yet Another layer of includes, but these are some VST3-specific typedefs that
// we'll need for all of our interfaces
using Steinberg::TBool, Steinberg::int8, Steinberg::int32, Steinberg::tresult;
/**
* Both `TUID` (`int8_t[16]`) and `FIDString` (`char*`) are hard to work with
* because you can't just copy them. So when serializing/deserializing them
* we'll use `std::array`.
*/
using ArrayUID = std::array<
std::remove_reference_t<decltype(std::declval<Steinberg::TUID>()[0])>,
std::extent_v<Steinberg::TUID>>;