MemoryFileStruct Class Reference

#include <c4d_file.h>

Detailed Description

Used with Filename::SetMemoryWriteMode() to make a BaseFile write to a memory buffer instead of a file.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Private Member Functions

 MemoryFileStruct ()
 
 ~MemoryFileStruct ()
 

Alloc/Free

static MemoryFileStructAlloc ()
 
static void Free (MemoryFileStruct *&mfs)
 

Get Data

void GetData (void *&data, Int &size) const
 
void GetData (void *&data, Int &size, Bool release=false)
 

Constructor & Destructor Documentation

◆ MemoryFileStruct()

MemoryFileStruct ( )
private

◆ ~MemoryFileStruct()

~MemoryFileStruct ( )
private

Member Function Documentation

◆ Alloc()

static MemoryFileStruct* Alloc ( )
static

Allocates a memory file. Destroy the allocated memory file with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated memory file, or nullptr if the allocation failed.

◆ Free()

static void Free ( MemoryFileStruct *&  mfs)
static

Destructs memory files allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]mfsThe memory file to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetData() [1/2]

void GetData ( void *&  data,
Int size 
) const

Gets the data written to the memory file.

Since
R16
Parameters
[out]dataAssigned a pointer to the data written.
[out]sizeAssigned the size of the data written.

◆ GetData() [2/2]

void GetData ( void *&  data,
Int size,
Bool  release = false 
)

Gets the data written to the memory file.

Parameters
[out]dataAssigned a pointer to the data written.
[out]sizeAssigned the size of the data written.
[in]releaseIf true the ownership of the memory block is transfered to the caller, who then needs to free the memory with DeleteMem.
Otherwise the memory block will be freed when the MemoryFileStruct is destructed.