SDK DDF (Defold Data Format) API documentation

Version: alpha

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

Functions

OPTION_OFFSET_POINTERS()

OPTION_OFFSET_POINTERS()

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

PARAMETERS


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

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

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

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

FreeMessage()

FreeMessage(message)

Free message

PARAMETERS

message void* The message