U8SaveFile Class Reference

#include <U8SaveFile.h>

Inheritance diagram for U8SaveFile:

NamedArchiveFile ArchiveFile List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 U8SaveFile (IDataSource *ds)
virtual ~U8SaveFile ()
virtual bool exists (const std::string &name)
virtual uint8getObject (const std::string &name, uint32 *size=0)
virtual uint32 getSize (const std::string &name)
virtual uint32 getCount ()

Static Public Member Functions

static bool isU8SaveFile (IDataSource *ds)

Protected Attributes

IDataSourceds
uint32 count
std::map< std::string, uint32indices
std::vector< uint32offsets
std::vector< uint32sizes

Private Member Functions

bool readMetadata ()
bool findIndex (const std::string &name, uint32 &index)

Detailed Description

Definition at line 27 of file U8SaveFile.h.


Constructor & Destructor Documentation

U8SaveFile::U8SaveFile ( IDataSource ds  )  [explicit]

create U8SaveFile from datasource; U8SaveFile takes ownership of ds and deletes it when destructed

Definition at line 27 of file U8SaveFile.cpp.

References count, ds, isU8SaveFile(), readMetadata(), and ArchiveFile::valid.

U8SaveFile::~U8SaveFile (  )  [virtual]

Definition at line 37 of file U8SaveFile.cpp.

References ds.


Member Function Documentation

U8SaveFile::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from NamedArchiveFile.

bool U8SaveFile::exists ( const std::string &  name  )  [virtual]

Check if named object exists If the Flex is not named, name must be an integer with an optional extension

Parameters:
name name of object to check for

Implements NamedArchiveFile.

Definition at line 87 of file U8SaveFile.cpp.

References findIndex().

bool U8SaveFile::findIndex ( const std::string &  name,
uint32 index 
) [private]

Definition at line 78 of file U8SaveFile.cpp.

References indices.

Referenced by exists(), getObject(), and getSize().

virtual uint32 U8SaveFile::getCount (  )  [inline, virtual]

Get upper bound for number of objects. In an indexed file this is (probably) the highest index plus one, while in a named file it's (probably) the actual count

Implements NamedArchiveFile.

Definition at line 42 of file U8SaveFile.h.

References count.

uint8 * U8SaveFile::getObject ( const std::string &  name,
uint32 size = 0 
) [virtual]

Get named object from file; returns NULL if name is invalid. Must delete the returned buffer afterwards. See also exists(std::string name)

Parameters:
name name of object to fetch
size if non-NULL, size of object is stored in *size

Implements NamedArchiveFile.

Definition at line 93 of file U8SaveFile.cpp.

References ds, findIndex(), offsets, IDataSource::read(), IDataSource::seek(), and sizes.

uint32 U8SaveFile::getSize ( const std::string &  name  )  [virtual]

Get size of named object; returns zero if name is invalid See also exists(std::string name)

Parameters:
index index of object to get size of

Implements NamedArchiveFile.

Definition at line 113 of file U8SaveFile.cpp.

References findIndex(), and sizes.

bool U8SaveFile::isU8SaveFile ( IDataSource ds  )  [static]

Definition at line 43 of file U8SaveFile.cpp.

References ds, IDataSource::read(), and IDataSource::seek().

Referenced by Pentagram::Archive::addSource(), and U8SaveFile().

bool U8SaveFile::readMetadata (  )  [private]

Definition at line 53 of file U8SaveFile.cpp.

References count, ds, IDataSource::getPos(), indices, offsets, IDataSource::read(), IDataSource::read2(), IDataSource::read4(), IDataSource::seek(), sizes, IDataSource::skip(), and NamedArchiveFile::storeIndexedName().

Referenced by U8SaveFile().


Member Data Documentation

uint32 U8SaveFile::count [protected]

Definition at line 48 of file U8SaveFile.h.

Referenced by getCount(), readMetadata(), and U8SaveFile().

IDataSource* U8SaveFile::ds [protected]

Definition at line 47 of file U8SaveFile.h.

Referenced by getObject(), isU8SaveFile(), readMetadata(), U8SaveFile(), and ~U8SaveFile().

std::map<std::string, uint32> U8SaveFile::indices [protected]

Definition at line 50 of file U8SaveFile.h.

Referenced by findIndex(), and readMetadata().

std::vector<uint32> U8SaveFile::offsets [protected]

Definition at line 51 of file U8SaveFile.h.

Referenced by getObject(), and readMetadata().

std::vector<uint32> U8SaveFile::sizes [protected]

Definition at line 52 of file U8SaveFile.h.

Referenced by getObject(), getSize(), and readMetadata().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:30:05 2007 for pentagram by  doxygen 1.4.7