Add ctor for Variant from Span<byte>
This commit is contained in:
@@ -86,6 +86,8 @@ struct BoundingFrustum;
|
||||
struct Color;
|
||||
struct Color32;
|
||||
struct Variant;
|
||||
template<typename T>
|
||||
class Span;
|
||||
class HeapAllocation;
|
||||
template<int Capacity>
|
||||
class FixedAllocation;
|
||||
|
||||
@@ -773,6 +773,21 @@ Variant::Variant(const Dictionary<Variant, Variant>& v)
|
||||
AsDictionary = New<Dictionary<Variant, Variant>>(v);
|
||||
}
|
||||
|
||||
Variant::Variant(const Span<byte>& v)
|
||||
: Type(VariantType::Blob)
|
||||
{
|
||||
AsBlob.Length = v.Length();
|
||||
if (AsBlob.Length > 0)
|
||||
{
|
||||
AsBlob.Data = Allocator::Allocate(AsBlob.Length);
|
||||
Platform::MemoryCopy(AsBlob.Data, v.Get(), AsBlob.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
AsBlob.Data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Variant::Variant(const CommonValue& value)
|
||||
: Variant()
|
||||
{
|
||||
|
||||
@@ -229,6 +229,7 @@ public:
|
||||
Variant(Array<Variant, HeapAllocation>&& v);
|
||||
Variant(const Array<Variant, HeapAllocation>& v);
|
||||
explicit Variant(const Dictionary<Variant, Variant, HeapAllocation>& v);
|
||||
explicit Variant(const Span<byte>& v);
|
||||
explicit Variant(const CommonValue& v);
|
||||
|
||||
~Variant();
|
||||
|
||||
Reference in New Issue
Block a user