Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Protected Member Functions | Protected Attributes
resource::Serializer Class Reference

#include <Serializer.h>

List of all members.

Public Member Functions

virtual bool exportResource (Resource *source, const std::string &filename)
 Exports a resource to the file specified.
virtual bool importResource (DataStream *stream, Resource *dest)
 Imports a resource from a file DataStream.
 Serializer ()
virtual ~Serializer ()

Protected Member Functions

void readBools (DataStream *stream, bool *dest, u32 count)
virtual u16 readChunk (DataStream *stream)
virtual void readFileHeader (DataStream *stream)
void readFloats (DataStream *stream, f32 *dest, u32 count)
void readLongs (DataStream *stream, u32 *dest, u32 count)
void readObject (DataStream *stream, core::vector3d *dest)
void readObject (DataStream *stream, core::quaternion *dest)
void readShorts (DataStream *stream, u16 *dest, u32 count)
std::string readString (DataStream *stream)
void writebools (const bool *src, u32 count)
virtual void writeChunkHeader (u16 id, u32 size)
void writeData (const void *buf, u32 size, u32 count)
virtual void writeFileHeader ()
void writeFloats (const f32 *src, u32 count)
void writeLongs (const u32 *src, u32 count)
void writeObject (const core::quaternion &q)
void writeObject (const core::vector3d &vec)
void writeShorts (const u16 *src, u32 count)
void writeString (const std::string &string)

Protected Attributes

u32 mCurrentChunkLen
ResourceType mResourceType
std::string mVersion

Detailed Description

Generic class for serialising data to / from binary chunk-based files.

This class provides a number of useful methods for exporting / importing data from chunk-oriented binary files (e.g. .mesh).

Constructor & Destructor Documentation

resource::Serializer::Serializer ( )

References mVersion.

resource::Serializer::~Serializer ( ) [virtual]

Member Function Documentation

bool resource::Serializer::exportResource ( Resource source,
const std::string &  filename 
) [virtual]

Exports a resource to the file specified.

bool resource::Serializer::importResource ( DataStream stream,
Resource dest 
) [virtual]

Imports a resource from a file DataStream.

Referenced by resource::Resource::loadImpl().

void resource::Serializer::readBools ( DataStream stream,
bool *  dest,
u32  count 
) [protected]
u16 resource::Serializer::readChunk ( DataStream stream) [protected, virtual]
void resource::Serializer::readFileHeader ( DataStream stream) [protected, virtual]
void resource::Serializer::readFloats ( DataStream stream,
f32 dest,
u32  count 
) [protected]

References resource::DataStream::read().

Referenced by readObject().

void resource::Serializer::readLongs ( DataStream stream,
u32 dest,
u32  count 
) [protected]

References resource::DataStream::read().

Referenced by readChunk().

void resource::Serializer::readObject ( DataStream stream,
core::vector3d dest 
) [protected]
void resource::Serializer::readObject ( DataStream stream,
core::quaternion dest 
) [protected]
void resource::Serializer::readShorts ( DataStream stream,
u16 dest,
u32  count 
) [protected]
std::string resource::Serializer::readString ( DataStream stream) [protected]
void resource::Serializer::writebools ( const bool *  src,
u32  count 
) [protected]

References writeData().

void resource::Serializer::writeChunkHeader ( u16  id,
u32  size 
) [protected, virtual]

References writeLongs(), and writeShorts().

void resource::Serializer::writeData ( const void *  buf,
u32  size,
u32  count 
) [protected]
void resource::Serializer::writeFileHeader ( ) [protected, virtual]
void resource::Serializer::writeFloats ( const f32 src,
u32  count 
) [protected]

References writeData().

Referenced by writeObject().

void resource::Serializer::writeLongs ( const u32 src,
u32  count 
) [protected]

References writeData().

Referenced by writeChunkHeader().

void resource::Serializer::writeObject ( const core::quaternion q) [protected]
void resource::Serializer::writeObject ( const core::vector3d vec) [protected]
void resource::Serializer::writeShorts ( const u16 src,
u32  count 
) [protected]

References writeData().

Referenced by writeChunkHeader(), and writeFileHeader().

void resource::Serializer::writeString ( const std::string &  string) [protected]

References mFile, and platform::File::writeLine().

Referenced by writeFileHeader().

Member Data Documentation

Referenced by readChunk().

Referenced by writeData(), and writeString().

std::string resource::Serializer::mVersion [protected]

The documentation for this class was generated from the following files:

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:10 by Doxygen (1.7.4)