mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 15:46:05 +02:00
Removed 'internal' protection - it's all about [Friend] now
This commit is contained in:
parent
81af04a1ce
commit
14ac27c977
119 changed files with 1339 additions and 1388 deletions
|
@ -4,8 +4,8 @@ namespace System
|
|||
{
|
||||
struct Variant
|
||||
{
|
||||
internal int mStructType; // 0 = unowned object, 1 = owned object, 2 = null value (mData is type), otherwise is struct type
|
||||
internal int mData; // This is either an Object reference, struct data, or a pointer to struct data
|
||||
int mStructType; // 0 = unowned object, 1 = owned object, 2 = null value (mData is type), otherwise is struct type
|
||||
int mData; // This is either an Object reference, struct data, or a pointer to struct data
|
||||
|
||||
public bool OwnsMemory
|
||||
{
|
||||
|
@ -49,7 +49,6 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
#if BF_ENABLE_REALTIME_LEAK_CHECK
|
||||
protected override void GCMarkMembers()
|
||||
{
|
||||
if ((mStructType == 1) || (mStructType == 0))
|
||||
|
@ -58,7 +57,6 @@ namespace System
|
|||
GC.Mark(obj);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public void Dispose() mut
|
||||
{
|
||||
|
@ -137,12 +135,12 @@ namespace System
|
|||
if (type.Size <= sizeof(int))
|
||||
{
|
||||
variant.mData = 0;
|
||||
Internal.MemCpy(&variant.mData, val, type.mSize);
|
||||
Internal.MemCpy(&variant.mData, val, type.[Friend]mSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
void* data = new uint8[type.mSize]*;
|
||||
Internal.MemCpy(data, val, type.mSize);
|
||||
void* data = new uint8[type.[Friend]mSize]*;
|
||||
Internal.MemCpy(data, val, type.[Friend]mSize);
|
||||
variant.mData = (int)data;
|
||||
}
|
||||
return variant;
|
||||
|
@ -166,27 +164,21 @@ namespace System
|
|||
}
|
||||
else
|
||||
{
|
||||
void* data = new uint8[type.mSize]*;
|
||||
void* data = new uint8[type.[Friend]mSize]*;
|
||||
variant.mData = (int)data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Get<T>(ref T val)
|
||||
{
|
||||
if (VariantType != typeof(T))
|
||||
return;
|
||||
val = Get<T>();
|
||||
}
|
||||
|
||||
public T Get<T>() where T : class
|
||||
{
|
||||
Debug.Assert(IsObject);
|
||||
if (mStructType == 2)
|
||||
return (T)null;
|
||||
Type type = typeof(T);
|
||||
T obj = (T)Internal.UnsafeCastToObject((void*)mData);
|
||||
Debug.Assert(obj.GetType().IsSubtypeOf(typeof(T)));
|
||||
Debug.Assert(obj.GetType().IsSubtypeOf(type));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -218,6 +210,13 @@ namespace System
|
|||
return *(T*)(void*)mData;
|
||||
}
|
||||
|
||||
/*public void Get<T>(ref T val)
|
||||
{
|
||||
if (VariantType != typeof(T))
|
||||
return;
|
||||
val = Get<T>();
|
||||
}*/
|
||||
|
||||
public void CopyValueData(void* dest)
|
||||
{
|
||||
if (IsObject)
|
||||
|
@ -269,9 +268,9 @@ namespace System
|
|||
return false;
|
||||
|
||||
let type = v1.VariantType;
|
||||
if (type.mSize <= sizeof(int))
|
||||
if (type.[Friend]mSize <= sizeof(int))
|
||||
return v1.mData == v2.mData;
|
||||
for (int i < type.mSize)
|
||||
for (int i < type.[Friend]mSize)
|
||||
{
|
||||
if (((uint8*)(void*)v1.mData)[i] != ((uint8*)(void*)v2.mData)[i])
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue