25 virtual size_t read(
void* dest,
size_t bytes);
43 virtual void seek(
size_t offset);
50 bool open(
bool useMemoryBuffer =
true);
66 bool setChunk(std::string chunkName,
bool resetToStart =
true);
Base class for all scene-graph nodes in the component hierarchy.
Abstract base class representing a file within the game data archive.
GameFile & operator=(const GameFile &)=delete
virtual void doPostOpenOperation()=0
unsigned char * getPointer()
Pointer to the current read position within the buffer.
virtual ~GameFile()=default
virtual bool doPostCloseOperation()=0
bool open(bool useMemoryBuffer=true)
Open the file, optionally loading into a memory buffer.
virtual void seek(size_t offset)
Seek to an absolute byte offset.
GameFile(std::string path, int id=-1)
size_t getPos()
Current read position.
size_t getSize()
Total size of the file in bytes.
std::vector< Chunk > chunks
virtual void dumpStructure()
virtual unsigned long readFile()=0
virtual bool isAlreadyOpened()=0
virtual bool openFile()=0
unsigned char * getBuffer() const
Pointer to the start of the internal buffer.
bool close()
Close the file and release the internal buffer.
virtual size_t read(void *dest, size_t bytes)
Read bytes from the file into dest.
unsigned long long pointer
void seekRelative(size_t offset)
Advance the read pointer by offset bytes.
void setFullName(const std::string &name)
const std::string & fullname() const
unsigned char * originalBuffer
bool setChunk(std::string chunkName, bool resetToStart=true)
Switch the active read window to the named chunk.
GameFile(const GameFile &)=delete
virtual bool getFileSize(unsigned long long &s)=0
void allocate(unsigned long long size)
Allocate (or reallocate) the internal buffer to the given size.
bool isChunked()
True if the file has been parsed into named chunks.
bool isEof()
True if the read pointer has reached the end of the file.