|
WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
|
Abstract base class representing a file within the game data archive. More...
#include <GameFile.h>
Classes | |
| struct | Chunk |
Public Member Functions | |
| GameFile (std::string path, int id=-1) | |
| virtual | ~GameFile ()=default |
| virtual size_t | read (void *dest, size_t bytes) |
| Read bytes from the file into dest. | |
| size_t | getSize () |
| Total size of the file in bytes. | |
| size_t | getPos () |
| Current read position. | |
| unsigned char * | getBuffer () const |
| Pointer to the start of the internal buffer. | |
| unsigned char * | getPointer () |
| Pointer to the current read position within the buffer. | |
| bool | isEof () |
| True if the read pointer has reached the end of the file. | |
| virtual void | seek (size_t offset) |
| Seek to an absolute byte offset. | |
| void | seekRelative (size_t offset) |
| Advance the read pointer by offset bytes. | |
| bool | open (bool useMemoryBuffer=true) |
| Open the file, optionally loading into a memory buffer. | |
| bool | close () |
| Close the file and release the internal buffer. | |
| void | setFullName (const std::string &name) |
| const std::string & | fullname () const |
| int | fileDataId () |
| void | allocate (unsigned long long size) |
| Allocate (or reallocate) the internal buffer to the given size. | |
| bool | setChunk (std::string chunkName, bool resetToStart=true) |
| Switch the active read window to the named chunk. | |
| bool | isChunked () |
| True if the file has been parsed into named chunks. | |
| virtual void | dumpStructure () |
Public Member Functions inherited from Component | |
| Component () | |
| virtual | ~Component () |
| virtual bool | addChild (Component *) |
| Add a child component to this node. | |
| virtual bool | removeChild (Component *) |
| Remove a child component from this node. | |
| virtual void | removeAllChildren () |
| virtual unsigned int | nbChildren () const |
| virtual bool | findChildComponent (Component *, bool) |
| virtual Component * | getChild (unsigned int) |
| virtual const Component * | getChild (unsigned int) const |
| void | setParentComponent (Component *) |
| Set the parent of this component. | |
| virtual void | onParentSet (Component *) |
| Called after the parent has been set; override for custom logic. | |
| const Component * | parent () const |
| Get the parent component (const). | |
| Component * | parent () |
| Get the parent component. | |
| template<class DataType > | |
| const DataType * | firstParentOfType () |
| Walk up the parent chain and return the first ancestor of the given type. | |
| void | ref () |
| Increment the reference counter. | |
| void | unref () |
| Decrement the reference counter; deletes this when it reaches zero. | |
| void | setName (const std::string &name) |
| std::string | name () const |
| virtual void | onNameChanged () |
| void | print (int l_depth=0) |
| virtual void | doPrint () |
| void | copy (const Component &component, bool) |
Protected Member Functions | |
| virtual bool | openFile ()=0 |
| virtual bool | isAlreadyOpened ()=0 |
| virtual bool | getFileSize (unsigned long long &s)=0 |
| virtual unsigned long | readFile ()=0 |
| virtual void | doPostOpenOperation ()=0 |
| virtual bool | doPostCloseOperation ()=0 |
Protected Attributes | |
| bool | eof |
| unsigned char * | buffer |
| unsigned long long | pointer |
| unsigned long long | size |
| std::string | filepath |
| int | m_fileDataId |
| std::vector< Chunk > | chunks |
| bool | m_useMemoryBuffer |
Private Member Functions | |
| GameFile (const GameFile &)=delete | |
| GameFile & | operator= (const GameFile &)=delete |
Private Attributes | |
| unsigned char * | originalBuffer |
| std::string | curChunk |
Abstract base class representing a file within the game data archive.
Provides a memory-buffered read interface with seek, chunk navigation, and subclass hooks for the actual I/O backend (CASC, hard-drive, etc.).
Definition at line 11 of file GameFile.h.
|
inline |
Definition at line 14 of file GameFile.h.
|
virtualdefault |
|
privatedelete |
| void GameFile::allocate | ( | unsigned long long | size | ) |
Allocate (or reallocate) the internal buffer to the given size.
Definition at line 84 of file GameFile.cpp.
| bool GameFile::close | ( | ) |
Close the file and release the internal buffer.
Definition at line 74 of file GameFile.cpp.
|
protectedpure virtual |
|
protectedpure virtual |
|
virtual |
Reimplemented in CASCFile.
Definition at line 154 of file GameFile.cpp.
|
inline |
|
inline |
| unsigned char * GameFile::getBuffer | ( | ) | const |
Pointer to the start of the internal buffer.
Definition at line 144 of file GameFile.cpp.
|
protectedpure virtual |
| unsigned char * GameFile::getPointer | ( | ) |
Pointer to the current read position within the buffer.
Definition at line 149 of file GameFile.cpp.
| size_t GameFile::getPos | ( | ) |
Current read position.
Definition at line 139 of file GameFile.cpp.
| size_t GameFile::getSize | ( | ) |
Total size of the file in bytes.
Definition at line 134 of file GameFile.cpp.
|
protectedpure virtual |
|
inline |
True if the file has been parsed into named chunks.
Definition at line 69 of file GameFile.h.
| bool GameFile::isEof | ( | ) |
True if the read pointer has reached the end of the file.
Definition at line 24 of file GameFile.cpp.
| bool GameFile::open | ( | bool | useMemoryBuffer = true | ) |
Open the file, optionally loading into a memory buffer.
Definition at line 41 of file GameFile.cpp.
|
protectedpure virtual |
|
virtual |
Read bytes from the file into dest.
Reimplemented in CASCFile.
Definition at line 5 of file GameFile.cpp.
|
protectedpure virtual |
|
virtual |
Seek to an absolute byte offset.
Reimplemented in CASCFile.
Definition at line 29 of file GameFile.cpp.
| void GameFile::seekRelative | ( | size_t | offset | ) |
Advance the read pointer by offset bytes.
Definition at line 35 of file GameFile.cpp.
| bool GameFile::setChunk | ( | std::string | chunkName, |
| bool | resetToStart = true |
||
| ) |
Switch the active read window to the named chunk.
| chunkName | Four-character chunk identifier. |
| resetToStart | If true, reset the read pointer to the chunk start. |
Definition at line 100 of file GameFile.cpp.
|
inline |
|
protected |
Definition at line 82 of file GameFile.h.
|
protected |
Definition at line 95 of file GameFile.h.
|
private |
Definition at line 102 of file GameFile.h.
|
protected |
Definition at line 81 of file GameFile.h.
|
protected |
Definition at line 84 of file GameFile.h.
|
protected |
Definition at line 85 of file GameFile.h.
|
protected |
Definition at line 96 of file GameFile.h.
|
private |
Definition at line 101 of file GameFile.h.
|
protected |
Definition at line 83 of file GameFile.h.
|
protected |
Definition at line 83 of file GameFile.h.