FlexFile Class Reference

#include <FlexFile.h>

Inheritance diagram for FlexFile:

ArchiveFile List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 FlexFile (IDataSource *ds)
virtual ~FlexFile ()
virtual bool exists (uint32 index)
virtual bool exists (const std::string &name)
virtual uint8getObject (uint32 index, uint32 *size=0)
virtual uint8getObject (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

IDataSourceds
uint32 count

Private Member Functions

uint32 getOffset (uint32 index)

Detailed Description

Definition at line 25 of file FlexFile.h.


Constructor & Destructor Documentation

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]

Definition at line 40 of file FlexFile.cpp.

References ds.


Member Function Documentation

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

Parameters:
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)

Parameters:
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)

Parameters:
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().

uint8 * FlexFile::getObject ( uint32  index,
uint32 size = 0 
) [virtual]

Get object from file; returns NULL if index is invalid. Must delete the returned buffer afterwards. See also exists(uint32 index)

Parameters:
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().

uint32 FlexFile::getOffset ( uint32  index  )  [private]

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)

Parameters:
index index of object to get size of

Implements ArchiveFile.

Definition at line 54 of file FlexFile.h.

References getSize(), and nameToIndex().

uint32 FlexFile::getSize ( uint32  index  )  [virtual]

Get size of object; returns zero if index is invalid. See also exists(uint32 index)

Parameters:
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]

is archive indexed?

Implements ArchiveFile.

Definition at line 66 of file FlexFile.h.

virtual bool FlexFile::isNamed (  )  const [inline, virtual]

is archive named?

Implements ArchiveFile.

Definition at line 67 of file FlexFile.h.

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().


Member Data Documentation

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().


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