Class AppLoad

3DS Max Plug-In SDK

Class AppLoad

See Also: Class AppSave, Class AppDataChunk.

class AppLoad

Description:

This class takes a chunk-ified data stream (as written by Class AppSave), and provides routines for decoding it.

This class is available in release 2.0 and later only.

All methods of this class are implemented by the system.

Prototype:

AppLoad *NewAppLoad(BYTE *buf, int bufSize);

Remarks:

This global function creates a new AppLoad instance for reading chunks out of buf:

Parameters:

BYTE *buf

The buffer to read.

int bufSize

Specifies the nuymber of bytes that are valid in buf.

Methods:

Prototype:

virtual void DeleteThis()=0;

Remarks:

This method deletes the instance of AppLoad.

Prototype:

virtual IOResult OpenChunk()=0;

Remarks:

This method is used to open a chunk. If OpenChunk() returns IO_OK, use the following 3 functions to get the information about the chunk. If it returns IO_END this indicates there are no more chunks at this level.

Return Value:

IO_OK - The result was acceptable - no errors.

IO_END - This is returned when the end of the chunks at a certain level have been reached. It is used as a signal to terminate the processing of chunks at that level.

IO_ERROR - This is returned if an error occurred.

Prototype:

virtual USHORT CurChunkID()=0;

Remarks:

This method returns the ID of the most recently opened chunk.

Prototype:

virtual ChunkType CurChunkType()=0;

Remarks:

This method returns the type of the most recently opened chunk. This may be one of the following values:

NEW_CHUNK

CONTAINER_CHUNK

DATA_CHUNK

Prototype:

virtual ULONG CurChunkLength()=0;

Remarks:

This method returns the chunk length not including the header.

Prototype:

virtual int CurChunkDepth()=0;

Remarks:

This method is used internally for checking for balanced OpenChunk/CloseChunk pairs.

Prototype:

virtual IOResult CloseChunk()=0;

Remarks:

This method is used to close the currently opened chunk, and position at the next chunk.

Parameters:

 

Return Value:

A return value of IO_ERROR indicates there is no open chunk to close; otherwise IO_OK.

Prototype:

virtual USHORT PeekNextChunkID()=0;

Remarks:

This method returns the ID of the next chunk without opening it. It returns 0 if there are no more chunks.

Prototype:

virtual IOResult Read(void *buf, ULONG nbytes, ULONG *nread )=0;

Remarks:

This method is used to read a block of bytes.

Parameters:

void *buf

A pointer to the buffer to read.

ULONG nbytes

The number of bytes to read.

ULONG *nread

The number of bytes that were read.

Return Value:

A return value of IO_ERROR indicates an error occurred, otherwise IO_OK.

Prototype:

virtual IOResult ReadWStringChunk(char** buf)=0;

Remarks:

This method read a string that was stored as Wide characters. Note: This method reads a string from a string chunk. It is assumed the chunk is already open, it will NOT close the chunk.

Parameters:

char** buf

A pointer to an array of characters.

Return Value:

A return value of IO_ERROR indicates an error occurred, otherwise IO_OK.

Prototype:

virtual IOResult ReadWStringChunk(wchar_t** buf)=0;

Remarks:

This method read a string that was stored as Wide characters. Note: This method reads a string from a string chunk. It is assumed the chunk is already open, it will NOT close the chunk.

Parameters:

wchar_t** buf

A pointer to an array of wide characters.

Return Value:

A return value of IO_ERROR indicates an error occurred, otherwise IO_OK.

Prototype:

virtual IOResult ReadCStringChunk(char** buf)=0;

Remarks:

This method reads a string that was stored as single byte characters.

Parameters:

char** buf

A pointer to an array of single byte characters.

Return Value:

A return value of IO_ERROR indicates an error occurred, otherwise IO_OK.

Prototype:

virtual IOResult ReadCStringChunk(wchar_t** buf)=0;

Remarks:

This method read a string that was stored as Wide chars. Note: This method reads a string from a string chunk. It is assumed the chunk is already open, it will NOT close the chunk.

Parameters:

wchar_t** buf

A pointer to an array of wide characters.

Return Value:

A return value of IO_ERROR indicates an error occurred, otherwise IO_OK.