ScummVM API documentation
Ultima::Ultima8::FlexFile Class Reference

Classes

struct  FileEntry
 

Public Member Functions

 FlexFile (Common::SeekableReadStream *rs)
 
bool isValid () const
 Check if constructed object is indeed a valid archive.
 
bool exists (uint32 index)
 
Common::SeekableReadStreamgetDataSource (uint32 index, bool is_text=false)
 
uint8 * getObject (uint32 index, uint32 *size=nullptr)
 
uint32 getSize (uint32 index) const
 
uint32 getCount () const
 

Static Public Member Functions

static bool isFlexFile (Common::SeekableReadStream *rs)
 

Protected Attributes

Common::SeekableReadStream_rs
 
bool _valid
 
Common::Array< FileEntry_entries
 

Constructor & Destructor Documentation

◆ FlexFile()

Ultima::Ultima8::FlexFile::FlexFile ( Common::SeekableReadStream rs)
explicit

create FlexFile from datasource; FlexFile takes ownership of ds and deletes it when destructed

Member Function Documentation

◆ exists()

bool Ultima::Ultima8::FlexFile::exists ( uint32  index)
inline

Check if numbered object exists

Parameters
indexindex of object to check for

◆ getDataSource()

Common::SeekableReadStream* Ultima::Ultima8::FlexFile::getDataSource ( uint32  index,
bool  is_text = false 
)

Get object as a Common::SeekableReadStream Delete the SeekableReadStream afterwards; that will delete the data as well

◆ getObject()

uint8* Ultima::Ultima8::FlexFile::getObject ( uint32  index,
uint32 *  size = nullptr 
)

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

Parameters
indexindex of object to fetch
sizeif non-NULL, size of object is stored in *size

◆ getSize()

uint32 Ultima::Ultima8::FlexFile::getSize ( uint32  index) const

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

Parameters
indexindex of object to get size of

◆ getCount()

uint32 Ultima::Ultima8::FlexFile::getCount ( ) const
inline

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


The documentation for this class was generated from the following file: