#include <U8SaveFile.h>
Inheritance diagram for U8SaveFile:
Public Member Functions | |
ENABLE_RUNTIME_CLASSTYPE () | |
U8SaveFile (IDataSource *ds) | |
virtual | ~U8SaveFile () |
virtual bool | exists (const std::string &name) |
virtual uint8 * | getObject (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 | |
IDataSource * | ds |
uint32 | count |
std::map< std::string, uint32 > | indices |
std::vector< uint32 > | offsets |
std::vector< uint32 > | sizes |
Private Member Functions | |
bool | readMetadata () |
bool | findIndex (const std::string &name, uint32 &index) |
Definition at line 27 of file U8SaveFile.h.
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] |
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
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.
Get named object from file; returns NULL if name is invalid. Must delete the returned buffer afterwards. See also exists(std::string name)
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)
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().
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] |
std::vector<uint32> U8SaveFile::offsets [protected] |
std::vector<uint32> U8SaveFile::sizes [protected] |
Definition at line 52 of file U8SaveFile.h.
Referenced by getObject(), getSize(), and readMetadata().