mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 05:14:10 +02:00
Add AllocOwned
to Variant
This commit is contained in:
parent
1223395a01
commit
9f441ed8f7
1 changed files with 17 additions and 0 deletions
|
@ -265,6 +265,23 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void* AllocOwned(Type type, out Variant variant)
|
||||||
|
{
|
||||||
|
variant = .();
|
||||||
|
|
||||||
|
if (type.IsObject)
|
||||||
|
{
|
||||||
|
return &variant.mData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
variant.mStructType = (int)Internal.UnsafeCastToPtr(type) | 1;
|
||||||
|
void* data = new uint8[type.[Friend]mSize]*;
|
||||||
|
variant.mData = (int)data;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public T Get<T>() where T : class
|
public T Get<T>() where T : class
|
||||||
{
|
{
|
||||||
Debug.Assert(IsObject);
|
Debug.Assert(IsObject);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue