Murl Engine Lua Addon API  Version 1.0 beta
Murl.Data

The Data object holds a pointer and size information to an allocated memory data location.

see also ConstData, BufferedData

Usage examples:

include "murl_data.h"
// convert to / from String
String s("abc");
Data data(s);
String s = data.GetString();
// convert to / from Hex String
Data key = Util::DecodeHex("0123456789ABCDEF");
String hexString = Util::EncodeHex(key.GetString());
// convert to / from UInt8Array
UInt8Array byteArray;
for (UInt32 i = 0; i < 100; i++)
{
byteArray.Add(i);
}
Data data;
data.ResizeData(byteArray.GetByteSize());
data.CopyFrom(byteArray.Begin(), byteArray.GetCount(), 0);
byteArray.Clear();
byteArray.SetCount(data.GetByteSize());
data.CopyTo(byteArray.Begin(), byteArray.GetCount(), 0);


Table members

Inherited


Murl.MutableData

Functions


Murl.Data.new()

The default constructor.

Murl.Data new()

Returns
Murl.Data

Murl.Data.new(byteSize)

Constructor allocating memory. The allocated memory is filled with zeros.

Murl.Data new(Integer byteSize)

Parameters
byteSizeByte size of the memory to allocate.
Returns
Murl.Data

Murl.Data.new(string)

The copy constructor taking a String object.

Murl.Data new(String string)

Parameters
stringThe string object to copy.
Returns
Murl.Data

Murl.Data.new(data)

The copy constructor taking a ConstData object.

Murl.Data new(Murl.ConstData data)

Parameters
dataThe data object to copy.
Returns
Murl.Data

Murl.Data.new(data)

The copy constructor.

Murl.Data new(Murl.Data data)

Parameters
dataThe data object to copy.
Returns
Murl.Data

Murl.Data.new(data)

The copy constructor taking a MutableData object.

Murl.Data new(Murl.MutableData data)

Parameters
dataThe data object to copy.
Returns
Murl.Data


Methods


ReleaseData()

Release the data. Free (delete) the memory.

ReleaseData()


ObtainData(data)

Obtain the memory from a data object. The source data object is empty after obtaining.

Murl.Data ObtainData(Murl.Data data)

Parameters
dataThe data object to obtain.
Returns
Murl.Data data The data object to obtain.

ResizeData(newByteSize)

Resize the memory. The content of the current memory is copied into the resized memory. The current memory is truncated if the new size is smaller, the remaining new memory is filled with zeros if the new size is larger.

ResizeData(Integer newByteSize)

Parameters
newByteSizeThe new byte size of the memory.