[keel] Add convert function to bare metal build so that the symbol is available
This commit is contained in:
parent
9ba13b17b1
commit
969914ce41
@ -10,12 +10,13 @@
|
|||||||
namespace keel {
|
namespace keel {
|
||||||
|
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static ox::Result<const BaseConverter*> findConverter(
|
static ox::Result<const BaseConverter*> findConverter(
|
||||||
keel::Context *ctx,
|
keel::Context *ctx,
|
||||||
ox::CRStringView srcTypeName, int srcTypeVersion,
|
ox::CRStringView srcTypeName,
|
||||||
ox::CRStringView dstTypeName, int dstTypeVersion) noexcept {
|
int srcTypeVersion,
|
||||||
|
ox::CRStringView dstTypeName,
|
||||||
|
int dstTypeVersion) noexcept {
|
||||||
for (auto &c : ctx->converters) {
|
for (auto &c : ctx->converters) {
|
||||||
if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
|
if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
|
||||||
return c;
|
return c;
|
||||||
@ -25,9 +26,12 @@ static ox::Result<const BaseConverter*> findConverter(
|
|||||||
};
|
};
|
||||||
|
|
||||||
static ox::Result<ox::UniquePtr<Wrap>> convert(
|
static ox::Result<ox::UniquePtr<Wrap>> convert(
|
||||||
keel::Context *ctx, const ox::Buffer &srcBuffer,
|
[[maybe_unused]] keel::Context *ctx,
|
||||||
ox::CRStringView srcTypeName, int srcTypeVersion,
|
[[maybe_unused]] const ox::Buffer &srcBuffer,
|
||||||
ox::CRStringView dstTypeName, int dstTypeVersion) noexcept {
|
[[maybe_unused]] ox::CRStringView srcTypeName,
|
||||||
|
[[maybe_unused]] int srcTypeVersion,
|
||||||
|
[[maybe_unused]] ox::CRStringView dstTypeName,
|
||||||
|
[[maybe_unused]] int dstTypeVersion) noexcept {
|
||||||
// look for direct converter
|
// look for direct converter
|
||||||
auto [c, err] = findConverter(ctx, srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion);
|
auto [c, err] = findConverter(ctx, srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
@ -47,16 +51,19 @@ static ox::Result<ox::UniquePtr<Wrap>> convert(
|
|||||||
}
|
}
|
||||||
return OxError(1, "Could not convert between types");
|
return OxError(1, "Could not convert between types");
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::UniquePtr<Wrap>> convert(
|
|
||||||
keel::Context *ctx,
|
|
||||||
const ox::Buffer &srcBuffer,
|
|
||||||
ox::CRStringView dstTypeName,
|
|
||||||
int dstTypeVersion) noexcept {
|
|
||||||
oxRequire(hdr, readAssetHeader(srcBuffer));
|
|
||||||
return convert(ctx, srcBuffer, hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, dstTypeName, dstTypeVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ox::Result<ox::UniquePtr<Wrap>> convert(
|
||||||
|
[[maybe_unused]] keel::Context *ctx,
|
||||||
|
[[maybe_unused]] const ox::Buffer &srcBuffer,
|
||||||
|
[[maybe_unused]] ox::CRStringView dstTypeName,
|
||||||
|
[[maybe_unused]] int dstTypeVersion) noexcept {
|
||||||
|
#ifndef OX_BARE_METAL
|
||||||
|
oxRequire(hdr, readAssetHeader(srcBuffer));
|
||||||
|
return convert(ctx, srcBuffer, hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, dstTypeName, dstTypeVersion);
|
||||||
|
#else
|
||||||
|
return OxError(1, "Operation not supported on this platform");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user