$#include "File.h" /// File open mode. enum FileMode { FILE_READ = 0, FILE_WRITE, FILE_READWRITE }; /// %File opened either through the filesystem or from within a package file. class File : public Deserializer { public: /// Read bytes from the file. Return number of bytes actually read. virtual unsigned Read(void* dest, unsigned size); /// Set position from the beginning of the file. virtual unsigned Seek(unsigned position); /// Return the file name. virtual const String& GetName() const; /// Return a checksum of the file contents using the SDBM hash algorithm. virtual unsigned GetChecksum(); /// Open a filesystem file. Return true if successful. bool Open(const String& fileName, FileMode mode = FILE_READ); /// Open from within a package file. Return true if successful. bool Open(PackageFile* package, const String& fileName); /// Close the file. void Close(); /// Flush any buffered output to the file. void Flush(); /// Change the file name. Used by the resource system. void SetName(const String& name); /// Return the open mode. FileMode GetMode() const; /// Return whether is open. bool IsOpen() const; /// Return the file handle. void* GetHandle() const; /// Return whether the file originates from a package. bool IsPackaged() const; };