mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Implement IpluginFactory3::getClassInfoUnicode
This commit is contained in:
@@ -60,8 +60,14 @@ YaPluginFactory::YaPluginFactory(
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Copy data from `IPluginFactory3`
|
||||
known_iids.insert(factory3->iid);
|
||||
// `IpluginFactory3::getClassInfoUnicode`
|
||||
for (int i = 0; i < num_classes; i++) {
|
||||
Steinberg::PClassInfoW info;
|
||||
if (factory3->getClassInfoUnicode(i, &info) == Steinberg::kResultOk) {
|
||||
class_infos_unicode[i] = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
YaPluginFactory::~YaPluginFactory() {
|
||||
@@ -110,7 +116,7 @@ int32 PLUGIN_API YaPluginFactory::countClasses() {
|
||||
|
||||
tresult PLUGIN_API YaPluginFactory::getClassInfo(Steinberg::int32 index,
|
||||
Steinberg::PClassInfo* info) {
|
||||
if (index >= static_cast<int32>(class_infos_1.size())) {
|
||||
if (index >= static_cast<int32>(class_infos_unicode.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
@@ -137,8 +143,16 @@ YaPluginFactory::getClassInfo2(int32 index, Steinberg::PClassInfo2* info) {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory::getClassInfoUnicode(int32 /*index*/,
|
||||
Steinberg::PClassInfoW* /*info*/) {
|
||||
// TODO: Implement
|
||||
return 0;
|
||||
YaPluginFactory::getClassInfoUnicode(int32 index,
|
||||
Steinberg::PClassInfoW* info) {
|
||||
if (index >= static_cast<int32>(class_infos_unicode.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
if (class_infos_unicode[index]) {
|
||||
*info = *class_infos_unicode[index];
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kResultFalse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,11 @@ class YaPluginFactory : public Steinberg::IPluginFactory3 {
|
||||
* For `IPluginFactory2::getClassInfo2`, works the same way as the above.
|
||||
*/
|
||||
std::vector<std::optional<Steinberg::PClassInfo2>> class_infos_2;
|
||||
/**
|
||||
* For `IPluginFactory3::getClassInfoUnicode`, works the same way as the
|
||||
* above.
|
||||
*/
|
||||
std::vector<std::optional<Steinberg::PClassInfoW>> class_infos_unicode;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
@@ -127,6 +132,10 @@ class YaPluginFactory : public Steinberg::IPluginFactory3 {
|
||||
[](S& s, std::optional<Steinberg::PClassInfo2>& info) {
|
||||
s.ext(info, bitsery::ext::StdOptional{});
|
||||
});
|
||||
s.container(class_infos_unicode, 2048,
|
||||
[](S& s, std::optional<Steinberg::PClassInfoW>& info) {
|
||||
s.ext(info, bitsery::ext::StdOptional{});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -156,6 +165,19 @@ void serialize(S& s, PClassInfo2& class_info) {
|
||||
s.text1b(class_info.sdkVersion);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, PClassInfoW& class_info) {
|
||||
s.container1b(class_info.cid);
|
||||
s.value4b(class_info.cardinality);
|
||||
s.text1b(class_info.category);
|
||||
s.text2b(class_info.name);
|
||||
s.value4b(class_info.classFlags);
|
||||
s.text1b(class_info.subCategories);
|
||||
s.text2b(class_info.vendor);
|
||||
s.text2b(class_info.version);
|
||||
s.text2b(class_info.sdkVersion);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, PFactoryInfo& factory_info) {
|
||||
s.text1b(factory_info.vendor);
|
||||
|
||||
Reference in New Issue
Block a user