[keel,studio] Add support for New Item templates
Some checks failed
Build / build (push) Failing after 1m3s
Some checks failed
Build / build (push) Failing after 1m3s
This commit is contained in:
@ -20,6 +20,8 @@ class Wrap {
|
||||
virtual ox::CStringView typeName() const noexcept = 0;
|
||||
[[nodiscard]]
|
||||
virtual int typeVersion() const noexcept = 0;
|
||||
[[nodiscard]]
|
||||
virtual ox::UAnyPtr moveToCopy() noexcept = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -27,6 +29,11 @@ class WrapT: public Wrap {
|
||||
public:
|
||||
[[nodiscard]]
|
||||
virtual constexpr T &obj() noexcept = 0;
|
||||
|
||||
ox::UAnyPtr moveToCopy() noexcept final {
|
||||
return new T{std::move(obj())};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -184,7 +191,18 @@ ox::Result<ox::UPtr<Wrap>> convert(
|
||||
auto &src,
|
||||
ox::StringViewCR dstTypeName,
|
||||
int const dstTypeVersion) noexcept {
|
||||
return convert(ctx, WrapRef{src}, dstTypeName, dstTypeVersion);
|
||||
WrapRef ref{src};
|
||||
return convert(ctx, static_cast<Wrap&>(ref), dstTypeName, dstTypeVersion);
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<Wrap>> convert(
|
||||
keel::Context &ctx,
|
||||
auto const&src,
|
||||
ox::StringViewCR dstTypeName,
|
||||
int const dstTypeVersion) noexcept {
|
||||
auto srcCpy = src;
|
||||
WrapRef ref{srcCpy};
|
||||
return convert(ctx, ref, dstTypeName, dstTypeVersion);
|
||||
}
|
||||
|
||||
template<typename DstType>
|
||||
|
Reference in New Issue
Block a user