Dali 3D User Interface Engine
List of all members | Public Types | Public Member Functions | Protected Attributes
Dali::Internal::Archive Class Referenceabstract

Archive class. More...

#include <archive.h>

Inheritance diagram for Dali::Internal::Archive:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::Archive:
Collaboration graph
[legend]

Public Types

typedef std::pair< unsigned
int, std::streampos > 
ChunkHeader
 

Public Member Functions

 Archive (std::streambuf &buf)
 Constructor. More...
 
virtual ~Archive ()
 Destructor. More...
 
unsigned int GetVersion () const
 Get archive version. More...
 
void SetVersion (const unsigned int version)
 Set archive version. More...
 
bool GetResult () const
 Returns the result of the archiving operation The result status is initialised to true on construction Any failure will set it to false. More...
 
void SetResultFailed ()
 Set the archive status to failed. More...
 
virtual bool Write (const char *data, const unsigned int length)
 Write a bytestream to the archive. More...
 
virtual bool Read (char *data, const unsigned int length)
 Read a bytestream from the archive. More...
 
virtual bool OpenChunk (const unsigned int tag)=0
 Open a new chunk. More...
 
virtual void SkipChunk (const unsigned int tag)
 Skip an entire chunk. More...
 
virtual void CloseChunk ()=0
 Close the current chunk The chunk length is written to the archive. More...
 
virtual unsigned int PeekChunk ()
 Peek at the tag of the next chunk. More...
 

Protected Attributes

unsigned int mVersion
 
std::iostream mStream
 
std::stack< ChunkHeadermChunkStack
 
bool mResult
 

Detailed Description

Archive class.

Serializes data to a Tag-Length-Value archive

Definition at line 40 of file archive.h.

Member Typedef Documentation

typedef std::pair<unsigned int, std::streampos> Dali::Internal::Archive::ChunkHeader

Definition at line 43 of file archive.h.

Constructor & Destructor Documentation

Dali::Internal::Archive::Archive ( std::streambuf &  buf)

Constructor.

Parameters
[in]bufAn open streambuf

Definition at line 42 of file archive.cpp.

Dali::Internal::Archive::~Archive ( )
virtual

Destructor.

Definition at line 49 of file archive.cpp.

References DALI_LOG_ERROR, and mChunkStack.

Member Function Documentation

virtual void Dali::Internal::Archive::CloseChunk ( )
pure virtual

Close the current chunk The chunk length is written to the archive.

Implemented in Dali::Internal::InputArchive, and Dali::Internal::OutputArchive.

bool Dali::Internal::Archive::GetResult ( ) const
inline

Returns the result of the archiving operation The result status is initialised to true on construction Any failure will set it to false.

Returns
the archiving result, true signals success.

Definition at line 80 of file archive.h.

References mResult.

unsigned int Dali::Internal::Archive::GetVersion ( ) const
inline

Get archive version.

Definition at line 60 of file archive.h.

References mVersion.

virtual bool Dali::Internal::Archive::OpenChunk ( const unsigned int  tag)
pure virtual

Open a new chunk.

Parameters
[in]tagThe FourCC tag for the chunk
Returns
true if success.

Implemented in Dali::Internal::InputArchive, and Dali::Internal::OutputArchive.

virtual unsigned int Dali::Internal::Archive::PeekChunk ( )
inlinevirtual

Peek at the tag of the next chunk.

This will move the file pointer to the next even byte, then read the next four bytes

Returns
The FourCC tag for the next chunk.

Reimplemented in Dali::Internal::InputArchive.

Definition at line 142 of file archive.h.

virtual bool Dali::Internal::Archive::Read ( char *  data,
const unsigned int  length 
)
inlinevirtual

Read a bytestream from the archive.

Parameters
[in]dataA pointer to a buffer to store the data
[in]lengthThe length of the data in bytes
Returns
true if the data was successfully read

Reimplemented in Dali::Internal::InputArchive.

Definition at line 110 of file archive.h.

Referenced by Dali::Internal::Serialize::operator>>().

Here is the caller graph for this function:

void Dali::Internal::Archive::SetResultFailed ( )
inline

Set the archive status to failed.

Definition at line 88 of file archive.h.

References mResult.

void Dali::Internal::Archive::SetVersion ( const unsigned int  version)
inline

Set archive version.

Parameters
[in]versionthe version number

Definition at line 69 of file archive.h.

References mVersion.

Referenced by Dali::Internal::InputArchive::InputArchive(), and Dali::Internal::OutputArchive::OutputArchive().

Here is the caller graph for this function:

virtual void Dali::Internal::Archive::SkipChunk ( const unsigned int  tag)
inlinevirtual

Skip an entire chunk.

Parameters
[in]tagThe FourCC tag for the chunk

Reimplemented in Dali::Internal::InputArchive.

Definition at line 126 of file archive.h.

virtual bool Dali::Internal::Archive::Write ( const char *  data,
const unsigned int  length 
)
inlinevirtual

Write a bytestream to the archive.

Parameters
[in]dataA pointer to the data
[in]lengthThe length of the data in bytes
Returns
true if the data was successfully written

Reimplemented in Dali::Internal::OutputArchive.

Definition at line 99 of file archive.h.

Referenced by Dali::Internal::Serialize::operator<<().

Here is the caller graph for this function:

Member Data Documentation

std::stack<ChunkHeader> Dali::Internal::Archive::mChunkStack
protected
bool Dali::Internal::Archive::mResult
protected
std::iostream Dali::Internal::Archive::mStream
protected
unsigned int Dali::Internal::Archive::mVersion
protected

Definition at line 148 of file archive.h.

Referenced by GetVersion(), and SetVersion().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali