NamedArchiveFile Class Reference

#include <NamedArchiveFile.h>

Inheritance diagram for NamedArchiveFile:

ArchiveFile DirFile U8SaveFile ZipFile List of all members.

Public Member Functions

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

Protected Member Functions

bool indexToName (uint32 index, std::string &name)
void storeIndexedName (const std::string &name)

Protected Attributes

std::map< uint32, std::string > indexedNames
uint32 indexCount

Detailed Description

Definition at line 24 of file NamedArchiveFile.h.


Constructor & Destructor Documentation

NamedArchiveFile::NamedArchiveFile (  )  [inline]

Definition at line 28 of file NamedArchiveFile.h.

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

Definition at line 29 of file NamedArchiveFile.h.


Member Function Documentation

NamedArchiveFile::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from ArchiveFile.

Reimplemented in DirFile, U8SaveFile, and ZipFile.

virtual bool NamedArchiveFile::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

Implements ArchiveFile.

Implemented in DirFile, U8SaveFile, and ZipFile.

virtual bool NamedArchiveFile::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 31 of file NamedArchiveFile.h.

References indexToName().

virtual uint32 NamedArchiveFile::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

Implements ArchiveFile.

Implemented in DirFile, U8SaveFile, and ZipFile.

virtual uint32 NamedArchiveFile::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 53 of file NamedArchiveFile.h.

References indexCount.

virtual uint8* NamedArchiveFile::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

Implements ArchiveFile.

Implemented in DirFile, U8SaveFile, and ZipFile.

virtual uint8* NamedArchiveFile::getObject ( uint32  index,
uint32 size = 0 
) [inline, 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 37 of file NamedArchiveFile.h.

References indexToName().

virtual uint32 NamedArchiveFile::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

Implements ArchiveFile.

Implemented in DirFile, U8SaveFile, and ZipFile.

virtual uint32 NamedArchiveFile::getSize ( uint32  index  )  [inline, 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 44 of file NamedArchiveFile.h.

References indexToName().

bool NamedArchiveFile::indexToName ( uint32  index,
std::string &  name 
) [inline, protected]

Definition at line 59 of file NamedArchiveFile.h.

References indexedNames.

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

virtual bool NamedArchiveFile::isIndexed (  )  const [inline, virtual]

is archive indexed?

Implements ArchiveFile.

Definition at line 55 of file NamedArchiveFile.h.

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

is archive named?

Implements ArchiveFile.

Definition at line 56 of file NamedArchiveFile.h.

void NamedArchiveFile::storeIndexedName ( const std::string &  name  )  [inline, protected]

Definition at line 67 of file NamedArchiveFile.h.

References ArchiveFile::extractIndexFromName(), indexCount, and indexedNames.

Referenced by ZipFile::readMetadata(), U8SaveFile::readMetadata(), and DirFile::readMetadata().


Member Data Documentation

uint32 NamedArchiveFile::indexCount [protected]

Definition at line 77 of file NamedArchiveFile.h.

Referenced by getIndexCount(), and storeIndexedName().

std::map<uint32, std::string> NamedArchiveFile::indexedNames [protected]

Definition at line 76 of file NamedArchiveFile.h.

Referenced by indexToName(), and storeIndexedName().


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