diff options
Diffstat (limited to 'common/file.h')
| -rw-r--r-- | common/file.h | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/common/file.h b/common/file.h index 3adeb6ff36..a2739f795f 100644 --- a/common/file.h +++ b/common/file.h @@ -31,20 +31,17 @@ #include "common/str.h" #include "common/stream.h" -class FilesystemNode; - namespace Common { +class FilesystemNode; + /** * TODO: vital to document this core class properly!!! For both users and implementors */ class File : public SeekableReadStream, public NonCopyable { protected: /** File handle to the actual file; 0 if no file is open. */ - void *_handle; - - /** Status flag which tells about recent I/O failures. */ - bool _ioFailed; + SeekableReadStream *_handle; /** The name of this file, for debugging. */ String _name; @@ -52,10 +49,10 @@ protected: public: static void addDefaultDirectory(const String &directory); - static void addDefaultDirectoryRecursive(const String &directory, int level = 4, const String &prefix = ""); + static void addDefaultDirectoryRecursive(const String &directory, int level = 4); static void addDefaultDirectory(const FilesystemNode &directory); - static void addDefaultDirectoryRecursive(const FilesystemNode &directory, int level = 4, const String &prefix = ""); + static void addDefaultDirectoryRecursive(const FilesystemNode &directory, int level = 4); static void resetDefaultDirectories(); @@ -93,18 +90,13 @@ public: bool ioFailed() const; void clearIOFailed(); - bool eos() const { return eof(); } - - /** - * Checks for end of file. - * - * @return: true if the end of file is reached, false otherwise. - */ - virtual bool eof() const; + bool err() const; + void clearErr(); + bool eos() const; - virtual uint32 pos() const; - virtual uint32 size() const; - void seek(int32 offs, int whence = SEEK_SET); + virtual int32 pos() const; + virtual int32 size() const; + bool seek(int32 offs, int whence = SEEK_SET); uint32 read(void *dataPtr, uint32 dataSize); }; @@ -118,7 +110,7 @@ public: class DumpFile : public WriteStream, public NonCopyable { protected: /** File handle to the actual file; 0 if no file is open. */ - void *_handle; + WriteStream *_handle; public: DumpFile(); @@ -136,24 +128,14 @@ public: */ bool isOpen() const; - - bool ioFailed() const; - void clearIOFailed(); - bool eos() const { return eof(); } - - /** - * Checks for end of file. - * - * @return: true if the end of file is reached, false otherwise. - */ - virtual bool eof() const; + bool err() const; + void clearErr(); virtual uint32 write(const void *dataPtr, uint32 dataSize); - virtual void flush(); + virtual bool flush(); }; - } // End of namespace Common #endif |
