ArchiveFile Class Reference

#include <ArchiveFile.h>

Inheritance diagram for ArchiveFile:

FlexFile NamedArchiveFile DirFile U8SaveFile ZipFile List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
virtual ~ArchiveFile ()
virtual bool isValid () const
virtual bool exists (uint32 index)=0
virtual bool exists (const std::string &name)=0
virtual uint8getObject (uint32 index, uint32 *size=0)=0
virtual uint8getObject (const std::string &name, uint32 *size=0)=0
virtual uint32 getSize (uint32 index)=0
virtual uint32 getSize (const std::string &name)=0
IDataSourcegetDataSource (uint32 index, bool is_text=false)
IDataSourcegetDataSource (const std::string &name, bool is_text=false)
virtual uint32 getCount ()=0
virtual uint32 getIndexCount ()=0
virtual bool isIndexed () const =0
virtual bool isNamed () const =0

Static Protected Member Functions

static bool extractIndexFromName (const std::string &name, uint32 &index)

Protected Attributes

bool valid

Detailed Description

Definition at line 25 of file ArchiveFile.h.


Constructor & Destructor Documentation

virtual ArchiveFile::~ArchiveFile (  )  [inline, virtual]

Definition at line 29 of file ArchiveFile.h.


Member Function Documentation

ArchiveFile::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented in DirFile, FlexFile, NamedArchiveFile, U8SaveFile, and ZipFile.

virtual bool ArchiveFile::exists ( const std::string &  name  )  [pure 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

Implemented in DirFile, FlexFile, NamedArchiveFile, U8SaveFile, and ZipFile.

virtual bool ArchiveFile::exists ( uint32  index  )  [pure 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

Implemented in FlexFile, and NamedArchiveFile.

bool ArchiveFile::extractIndexFromName ( const std::string &  name,
uint32 index 
) [static, protected]

Definition at line 27 of file ArchiveFile.cpp.

Referenced by FlexFile::nameToIndex(), and NamedArchiveFile::storeIndexedName().

virtual uint32 ArchiveFile::getCount (  )  [pure 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

Implemented in DirFile, FlexFile, NamedArchiveFile, U8SaveFile, and ZipFile.

IDataSource * ArchiveFile::getDataSource ( const std::string &  name,
bool  is_text = false 
)

Get named object as an IDataSource Delete the IDataSource afterwards; that will delete the data as well

Definition at line 56 of file ArchiveFile.cpp.

References getObject().

IDataSource * ArchiveFile::getDataSource ( uint32  index,
bool  is_text = false 
)

Get object as an IDataSource Delete the IDataSource afterwards; that will delete the data as well

Definition at line 46 of file ArchiveFile.cpp.

References getObject().

Referenced by World::loadItemCachNPCData(), World::loadNonFixed(), and U8Game::startGame().

virtual uint32 ArchiveFile::getIndexCount (  )  [pure 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

Implemented in FlexFile, and NamedArchiveFile.

Referenced by Pentagram::Archive::addSource().

virtual uint8* ArchiveFile::getObject ( const std::string &  name,
uint32 size = 0 
) [pure 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

Implemented in DirFile, FlexFile, NamedArchiveFile, U8SaveFile, and ZipFile.

virtual uint8* ArchiveFile::getObject ( uint32  index,
uint32 size = 0 
) [pure 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

Implemented in FlexFile, and NamedArchiveFile.

Referenced by getDataSource(), and Pentagram::Archive::getRawObject().

virtual uint32 ArchiveFile::getSize ( const std::string &  name  )  [pure 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

Implemented in DirFile, FlexFile, NamedArchiveFile, U8SaveFile, and ZipFile.

virtual uint32 ArchiveFile::getSize ( uint32  index  )  [pure 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

Implemented in FlexFile, and NamedArchiveFile.

Referenced by Pentagram::Archive::getRawSize().

virtual bool ArchiveFile::isIndexed (  )  const [pure virtual]

is archive indexed?

Implemented in FlexFile, and NamedArchiveFile.

virtual bool ArchiveFile::isNamed (  )  const [pure virtual]

is archive named?

Implemented in FlexFile, and NamedArchiveFile.

virtual bool ArchiveFile::isValid (  )  const [inline, virtual]

Check if constructed object is indeed a valid archive.

Definition at line 32 of file ArchiveFile.h.

References valid.

Referenced by Pentagram::Archive::addSource().


Member Data Documentation

bool ArchiveFile::valid [protected]

Definition at line 99 of file ArchiveFile.h.

Referenced by DirFile::DirFile(), FlexFile::FlexFile(), isValid(), U8SaveFile::U8SaveFile(), ZipFile::ZipFile(), and ZipFile::~ZipFile().


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