mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Add a string representation for universal tresult
This commit is contained in:
@@ -63,9 +63,7 @@ void Vst3Logger::log_response(
|
|||||||
<< ">";
|
<< ">";
|
||||||
},
|
},
|
||||||
[&](const UniversalTResult& code) {
|
[&](const UniversalTResult& code) {
|
||||||
// TODO: Add a `UniversalTResult::string()` for
|
message << code.string();
|
||||||
// the human readable representation
|
|
||||||
message << code.native();
|
|
||||||
}},
|
}},
|
||||||
result);
|
result);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,6 +55,39 @@ tresult UniversalTResult::native() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string UniversalTResult::string() const {
|
||||||
|
static_assert(Steinberg::kResultOk == Steinberg::kResultTrue);
|
||||||
|
switch (universal_result) {
|
||||||
|
case Value::kNoInterface:
|
||||||
|
return "kNoInterface";
|
||||||
|
break;
|
||||||
|
case Value::kResultOk:
|
||||||
|
return "kResultOk";
|
||||||
|
break;
|
||||||
|
case Value::kResultFalse:
|
||||||
|
return "kResultFalse";
|
||||||
|
break;
|
||||||
|
case Value::kInvalidArgument:
|
||||||
|
return "kInvalidArgument";
|
||||||
|
break;
|
||||||
|
case Value::kNotImplemented:
|
||||||
|
return "kNotImplemented";
|
||||||
|
break;
|
||||||
|
case Value::kInternalError:
|
||||||
|
return "kInternalError";
|
||||||
|
break;
|
||||||
|
case Value::kNotInitialized:
|
||||||
|
return "kNotInitialized";
|
||||||
|
break;
|
||||||
|
case Value::kOutOfMemory:
|
||||||
|
return "kOutOfMemory";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "<invalid>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UniversalTResult::Value UniversalTResult::to_universal_result(
|
UniversalTResult::Value UniversalTResult::to_universal_result(
|
||||||
tresult native_result) {
|
tresult native_result) {
|
||||||
static_assert(Steinberg::kResultOk == Steinberg::kResultTrue);
|
static_assert(Steinberg::kResultOk == Steinberg::kResultTrue);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <pluginterfaces/base/ftypes.h>
|
#include <pluginterfaces/base/ftypes.h>
|
||||||
#include <pluginterfaces/base/funknown.h>
|
#include <pluginterfaces/base/funknown.h>
|
||||||
@@ -68,6 +69,11 @@ class UniversalTResult {
|
|||||||
*/
|
*/
|
||||||
tresult native() const;
|
tresult native() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the original name for the result, e.g. `kResultOk`.
|
||||||
|
*/
|
||||||
|
std::string string() const;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
s.value4b(universal_result);
|
s.value4b(universal_result);
|
||||||
|
|||||||
Reference in New Issue
Block a user