#include <SaveC.h>
Public Methods | |
SaveC () | |
Default constructor. | |
virtual | ~SaveC () |
Default destructor. | |
virtual PajaTypes::uint32 | open (const char *szName, const PajaTypes::int8 *pSignature, PajaTypes::int32 i32SignatureSize) |
Opens output stream. | |
virtual PajaTypes::uint32 | close () |
Flushes all buffers and closes output stream. | |
virtual PajaTypes::uint32 | begin_chunk (PajaTypes::uint32 ui32ID, PajaTypes::uint32 ui32Version) |
Begins a chunk a data. | |
virtual PajaTypes::uint32 | end_chunk () |
Closes a chunk. | |
virtual PajaTypes::uint32 | write (const void *pBuffer, PajaTypes::uint32 ui32Len) |
Writes a buffer to the stream. | |
virtual PajaTypes::uint32 | write_str (const char *szStr) |
Writes string to the stream. | |
virtual PajaTypes::uint32 | get_error () |
Returns current error code. |
SaveC is used to save the information in Demopaja into a chunk based file format. The data in the output stream is serialized in chunk based format. Each begin_chunk() call should be closed with a call to the end_chunk() method.
This class is implemented by the system.
Example of save() method of an effect class:
uint32 TestEffectC::save( SaveC* pSave ) { uint32 ui32Error = IO_OK; // EffectI stuff pSave->begin_chunk( CHUNK_TESTEFFECT_BASE, TESTEFFECT_VERSION ); ui32Error = EffectI::save( pSave ); pSave->end_chunk(); // Save transform gizmo pSave->begin_chunk( CHUNK_TESTEFFECT_TRANSGIZMO, TESTEFFECT_VERSION ); ui32Error = m_pTransGizmo->save( pSave ); pSave->end_chunk(); // Save attribute gizmo pSave->begin_chunk( CHUNK_TESTEFFECT_ATTRIBGIZMO, TESTEFFECT_VERSION ); ui32Error = m_pAttribGizmo->save( pSave ); pSave->end_chunk(); return ui32Error; }
|
Default constructor.
|
|
Default destructor.
|
|
Begins a chunk a data.
Example: ... // Begin new chunk of data. pSave->begin_chunk( CHUNK_TGAIMPORT_NAME, TGAIMPORT_VERSION ); // Write data to a chunk. sStr = m_sFileName; if( sStr.size() > 255 ) sStr.resize( 255 ); ui32Error = pSave->write_str( sStr.c_str() ); // Close data chunk. pSave->end_chunk(); ... |
|
Flushes all buffers and closes output stream.
|
|
Closes a chunk. Calls to this method are hierarchial. There can be many chunks open at the same time. The chunk opened by the last call to begin_chunck() is closed.
|
|
Returns current error code.
|
|
Opens output stream. See FileIOErrorsE for more information on the error codes.
|
|
Writes a buffer to the stream.
|
|
Writes string to the stream.
|