diff options
author | David Corrales | 2007-08-05 19:34:20 +0000 |
---|---|---|
committer | David Corrales | 2007-08-05 19:34:20 +0000 |
commit | 6856535010bd2fa4449bcfde1c88dc06cd46e26f (patch) | |
tree | b81a2234c2beff0312c93e039d6cafda4babeca6 /engines/gob/dataio.h | |
parent | 1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (diff) | |
parent | ec1803f838d5efc7decf75c05a1fb4a9633751e5 (diff) | |
download | scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.gz scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.bz2 scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.zip |
Merged fsnode with trunk: r27971:28460
svn-id: r28462
Diffstat (limited to 'engines/gob/dataio.h')
-rw-r--r-- | engines/gob/dataio.h | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/engines/gob/dataio.h b/engines/gob/dataio.h index 3ea29c0efe..b30a389865 100644 --- a/engines/gob/dataio.h +++ b/engines/gob/dataio.h @@ -35,7 +35,33 @@ namespace Gob { #define MAX_FILES 30 #define MAX_DATA_FILES 8 -#define MAX_SLOT_COUNT 4 +#define MAX_SLOT_COUNT 8 + +class DataIO; + +class DataStream : public Common::SeekableReadStream { +public: + DataStream(DataIO &io, int16 handle, uint32 dSize, bool dispose = false); + DataStream(byte *buf, uint32 dSize, bool dispose = true); + virtual ~DataStream(); + + virtual uint32 pos() const; + virtual uint32 size() const; + + virtual void seek(int32 offset, int whence = SEEK_SET); + + virtual bool eos() const; + + virtual uint32 read(void *dataPtr, uint32 dataSize); + +private: + DataIO *_io; + int16 _handle; + uint32 _size; + byte *_data; + Common::MemoryReadStream *_stream; + bool _dispose; +}; class DataIO { public: @@ -55,15 +81,11 @@ public: void closeData(int16 handle); int16 openData(const char *path, Common::File::AccessMode mode = Common::File::kFileReadMode); - int32 readData(int16 handle, byte *buf, uint16 size); - byte readByte(int16 handle); - uint16 readUint16(int16 handle); - uint32 readUint32(int16 handle); - int32 writeData(int16 handle, byte *buf, uint16 size); - void seekData(int16 handle, int32 pos, int16 from); - uint32 getPos(int16 handle); + DataStream *openAsStream(int16 handle, bool dispose = false); + int32 getDataSize(const char *name); byte *getData(const char *path); + DataStream *getDataStream(const char *path); DataIO(class GobEngine *vm); ~DataIO(); @@ -85,13 +107,20 @@ protected: int16 file_open(const char *path, Common::File::AccessMode mode = Common::File::kFileReadMode); Common::File *file_getHandle(int16 handle); + const Common::File *file_getHandle(int16 handle) const; int16 getChunk(const char *chunkName); char freeChunk(int16 handle); int32 readChunk(int16 handle, byte *buf, uint16 size); int16 seekChunk(int16 handle, int32 pos, int16 from); - uint32 getChunkPos(int16 handle); + uint32 getChunkPos(int16 handle) const; int32 getChunkSize(const char *chunkName); + + uint32 getPos(int16 handle); + void seekData(int16 handle, int32 pos, int16 from); + int32 readData(int16 handle, byte *buf, uint16 size); + +friend class DataStream; }; } // End of namespace Gob |