[Scummvm-cvs-logs] SF.net SVN: scummvm: [25859] scummvm/trunk/common/stream.h
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Feb 25 19:35:52 CET 2007
Revision: 25859
http://scummvm.svn.sourceforge.net/scummvm/?rev=25859&view=rev
Author: fingolfin
Date: 2007-02-25 10:35:51 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
Add some doxygen comments to Common::Stream
Modified Paths:
--------------
scummvm/trunk/common/stream.h
Modified: scummvm/trunk/common/stream.h
===================================================================
--- scummvm/trunk/common/stream.h 2007-02-25 18:26:33 UTC (rev 25858)
+++ scummvm/trunk/common/stream.h 2007-02-25 18:35:51 UTC (rev 25859)
@@ -151,54 +151,122 @@
// 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 @@
/**
* 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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list