diff options
author | Max Horn | 2007-02-25 18:35:51 +0000 |
---|---|---|
committer | Max Horn | 2007-02-25 18:35:51 +0000 |
commit | 198f32ea8ee8c432a0b348c009e5f5a0a241dc86 (patch) | |
tree | 769ed5311b8d196ab2abd356c49d61f7ca6924af | |
parent | 7287ce2a4c478a1faa2a213a8d6d974797729353 (diff) | |
download | scummvm-rg350-198f32ea8ee8c432a0b348c009e5f5a0a241dc86.tar.gz scummvm-rg350-198f32ea8ee8c432a0b348c009e5f5a0a241dc86.tar.bz2 scummvm-rg350-198f32ea8ee8c432a0b348c009e5f5a0a241dc86.zip |
Add some doxygen comments to Common::Stream
svn-id: r25859
-rw-r--r-- | common/stream.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/common/stream.h b/common/stream.h index 3332b1beda..05bda78593 100644 --- a/common/stream.h +++ b/common/stream.h @@ -151,54 +151,122 @@ public: // The remaining methods all have default implementations; subclasses // need not (and should not) overload them. + /** + * Read am unsigned byte from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ byte readByte() { byte b = 0; read(&b, 1); return b; } + /** + * Read a signed byte from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ int8 readSByte() { int8 b = 0; read(&b, 1); return b; } + /** + * Read an unsigned 16-bit word stored in little endian (LSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ uint16 readUint16LE() { uint16 a = readByte(); uint16 b = readByte(); return a | (b << 8); } + /** + * Read an unsigned 32-bit word stored in little endian (LSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ uint32 readUint32LE() { uint32 a = readUint16LE(); uint32 b = readUint16LE(); return (b << 16) | a; } + /** + * Read an unsigned 16-bit word stored in big endian (MSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ uint16 readUint16BE() { uint16 b = readByte(); uint16 a = readByte(); return a | (b << 8); } + /** + * Read an unsigned 32-bit word stored in big endian (MSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ uint32 readUint32BE() { uint32 b = readUint16BE(); uint32 a = readUint16BE(); return (b << 16) | a; } + /** + * Read a signed 16-bit word stored in little endian (LSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ int16 readSint16LE() { return (int16)readUint16LE(); } + /** + * Read a signed 32-bit word stored in little endian (LSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ int32 readSint32LE() { return (int32)readUint32LE(); } + /** + * Read a signed 16-bit word stored in big endian (MSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ int16 readSint16BE() { return (int16)readUint16BE(); } + /** + * Read a signed 32-bit word stored in big endian (MSB first) order + * from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occured (for which client code can check by + * calling ioFailed()). + */ int32 readSint32BE() { return (int32)readUint32BE(); } @@ -206,6 +274,8 @@ public: /** * Read the specified amount of data into a malloc'ed buffer * which then is wrapped into a MemoryReadStream. + * The returned stream might contain less data than requested, + * if reading more failed. */ MemoryReadStream *readStream(uint32 dataSize); |