SDK DDF (Defold Data Format) API documentation

Version: beta

FUNCTIONS
FreeMessage() Free message
GetDescriptorFromHash() Get Descriptor from hash name
LoadMessage() Load/decode a DDF message from buffer
LoadMessage() Load/decode a DDF message from buffer
LoadMessage() Load/decode a DDF message from buffer. Template va...
LoadMessageFromFile() Load/decode a DDF message from file
OPTION_OFFSET_POINTERS() Store pointers as offset from base address. Needed...
ResolvePointers() If the message was loaded with the flag dmDDF::OPT...
SaveMessageToArray() Save message to array
ENUMS
Result result enumeration

Functions

FreeMessage()

FreeMessage(message)

Free message

PARAMETERS

message void* The message

GetDescriptorFromHash()

GetDescriptorFromHash(hash)

Get Descriptor from hash name

PARAMETERS

hash dmhash_t hash of type name

RETURNS

descriptor dmDDF::Descriptor* 0 if not found

LoadMessage()

LoadMessage(buffer,buffer_size,desc,message)

Load/decode a DDF message from buffer

PARAMETERS

buffer const void* Input buffer
buffer_size uint32_t Input buffer size in bytes
desc dmDDF::Descriptor* DDF descriptor
message void** (out) Destination pointer to message

RETURNS

RESULT_OK on success

LoadMessage()

LoadMessage(buffer,buffer_size,desc,message,options,size)

Load/decode a DDF message from buffer

PARAMETERS

buffer const void* Input buffer
buffer_size uint32_t Input buffer size in bytes
desc dmDDF::Descriptor* DDF descriptor
message void** (out) Destination pointer to message
options uint32_t options, eg dmDDF::OPTION_OFFSET_POINTERS
size uint32_t* (out) loaded message size

RETURNS

RESULT_OK on success

LoadMessage()

LoadMessage(buffer,buffer_size,message)

Load/decode a DDF message from buffer. Template variant

PARAMETERS

buffer const void* Input buffer
buffer_size uint32_t Input buffer size in bytes
message T** (out) Destination pointer to message

RETURNS

RESULT_OK on success

LoadMessageFromFile()

LoadMessageFromFile(file_name,desc,message)

Load/decode a DDF message from file

PARAMETERS

file_name const char* File name
desc dmDDF::Descriptor* DDF descriptor
message void** (out) Destination pointer to message

RETURNS

RESULT_OK on success

OPTION_OFFSET_POINTERS()

OPTION_OFFSET_POINTERS()

Store pointers as offset from base address. Needed when serializing entire messages (copy). Value (1 << 0)

PARAMETERS

None


ResolvePointers()

ResolvePointers(desc,message)

If the message was loaded with the flag dmDDF::OPTION_OFFSET_POINTERS, all pointers have their offset stored. This function resolves those offsets into actual pointers

PARAMETERS

desc dmDDF::Descriptor* DDF descriptor
message void* (int/out) The message to patch pointers in

RETURNS

RESULT_OK on success

SaveMessageToArray()

SaveMessageToArray(message,desc,buffer)

Save message to array

PARAMETERS

message const void* Message
desc dmDDF::Descriptor* DDF descriptor
buffer dmArray& Buffer to save to

RETURNS

RESULT_OK on success