#include <FlexFile.h>
Inheritance diagram for FlexFile:
Public Member Functions | |
ENABLE_RUNTIME_CLASSTYPE () | |
FlexFile (IDataSource *ds) | |
virtual | ~FlexFile () |
virtual bool | exists (uint32 index) |
virtual bool | exists (const std::string &name) |
virtual uint8 * | getObject (uint32 index, uint32 *size=0) |
virtual uint8 * | getObject (const std::string &name, uint32 *size=0) |
virtual uint32 | getSize (uint32 index) |
virtual uint32 | getSize (const std::string &name) |
virtual uint32 | getCount () |
virtual uint32 | getIndexCount () |
virtual bool | isIndexed () const |
virtual bool | isNamed () const |
Static Public Member Functions | |
static bool | isFlexFile (IDataSource *ds) |
Protected Member Functions | |
bool | nameToIndex (const std::string &name, uint32 &index) |
Protected Attributes | |
IDataSource * | ds |
uint32 | count |
Private Member Functions | |
uint32 | getOffset (uint32 index) |
Definition at line 25 of file FlexFile.h.
FlexFile::FlexFile | ( | IDataSource * | ds | ) | [explicit] |
create FlexFile from datasource; FlexFile takes ownership of ds and deletes it when destructed
Definition at line 28 of file FlexFile.cpp.
References count, ds, isFlexFile(), IDataSource::read4(), IDataSource::seek(), and ArchiveFile::valid.
FlexFile::~FlexFile | ( | ) | [virtual] |
FlexFile::ENABLE_RUNTIME_CLASSTYPE | ( | ) |
Reimplemented from ArchiveFile.
virtual bool FlexFile::exists | ( | const std::string & | name | ) | [inline, 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 ArchiveFile.
Definition at line 35 of file FlexFile.h.
References exists(), and nameToIndex().
virtual bool FlexFile::exists | ( | uint32 | index | ) | [inline, virtual] |
Check if numbered object exists If the Flex has named objects, only objects with numerical names will be returned (the filename without the extension must be an integer)
index | index of object to check for |
Implements ArchiveFile.
Definition at line 34 of file FlexFile.h.
References getSize().
Referenced by exists().
virtual uint32 FlexFile::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 ArchiveFile.
Definition at line 62 of file FlexFile.h.
References count.
Referenced by World::loadNonFixed().
virtual uint32 FlexFile::getIndexCount | ( | ) | [inline, virtual] |
Get the highest index in the file Guaranteed to be sufficiently large for a vector that needs to store the indexed entries of this file
Implements ArchiveFile.
Definition at line 64 of file FlexFile.h.
References count.
Referenced by FlexWriter::FlexWriter(), and main().
virtual uint8* FlexFile::getObject | ( | const std::string & | name, | |
uint32 * | size = 0 | |||
) | [inline, virtual] |
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 ArchiveFile.
Definition at line 44 of file FlexFile.h.
References getObject(), and nameToIndex().
Get object from file; returns NULL if index is invalid. Must delete the returned buffer afterwards. See also exists(uint32 index)
index | index of object to fetch | |
size | if non-NULL, size of object is stored in *size |
Implements ArchiveFile.
Definition at line 75 of file FlexFile.cpp.
References count, ds, getOffset(), getSize(), IDataSource::read(), and IDataSource::seek().
Referenced by FlexWriter::FlexWriter(), getObject(), and main().
Definition at line 69 of file FlexFile.cpp.
References ds, IDataSource::read4(), and IDataSource::seek().
Referenced by getObject().
virtual uint32 FlexFile::getSize | ( | const std::string & | name | ) | [inline, 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 ArchiveFile.
Definition at line 54 of file FlexFile.h.
References getSize(), and nameToIndex().
Get size of object; returns zero if index is invalid. See also exists(uint32 index)
index | index of object to get size of |
Implements ArchiveFile.
Definition at line 93 of file FlexFile.cpp.
References count, ds, IDataSource::read4(), and IDataSource::seek().
Referenced by exists(), getObject(), getSize(), World::loadNonFixed(), and main().
bool FlexFile::isFlexFile | ( | IDataSource * | ds | ) | [static] |
Definition at line 46 of file FlexFile.cpp.
References ds, IDataSource::read(), and IDataSource::seek().
Referenced by Pentagram::Archive::addSource(), FlexFile(), and main().
virtual bool FlexFile::isIndexed | ( | ) | const [inline, virtual] |
virtual bool FlexFile::isNamed | ( | ) | const [inline, virtual] |
bool FlexFile::nameToIndex | ( | const std::string & | name, | |
uint32 & | index | |||
) | [protected] |
Definition at line 103 of file FlexFile.cpp.
References ArchiveFile::extractIndexFromName().
Referenced by exists(), getObject(), and getSize().
uint32 FlexFile::count [protected] |
Definition at line 75 of file FlexFile.h.
Referenced by FlexFile(), getCount(), getIndexCount(), getObject(), and getSize().
IDataSource* FlexFile::ds [protected] |
Definition at line 74 of file FlexFile.h.
Referenced by FlexFile(), getObject(), getOffset(), getSize(), isFlexFile(), and ~FlexFile().