|
CartoType API
|
#include <cartotype_stream.h>
Public Member Functions | |
| TDataInputStream (MInputStream &aInputStream) | |
| void | Set (MInputStream &aInputStream) |
| CT_IMPORT TResult | Seek (int32 aPosition) |
| int32 | Position () const |
| bool | EndOfData () const |
| uint8 | ReadUint8 (TResult &aError) |
| CT_IMPORT uint16 | ReadUint16 (TResult &aError) |
| CT_IMPORT uint32 | ReadUint32 (TResult &aError) |
| uint16 | ReadUint16BigEndian (TResult &aError) |
| uint32 | ReadUint32BigEndian (TResult &aError) |
| CT_IMPORT uint32 | ReadUint (TResult &aError, int32 aSize) |
| TFixed | ReadFixed (TResult &aError, int32 aFractionalBits=16) |
| CT_IMPORT TFixed | ReadFloat (TResult &aError) |
| CT_IMPORT TFixed | ReadDouble (TResult &aError) |
| CT_IMPORT double | ReadDoubleFP (TResult &aError) |
| CT_IMPORT TFixed | ReadDoubleTo64ths (TResult &aError) |
| CT_IMPORT int32 | ReadFloatRounded (TResult &aError) |
| CT_IMPORT int32 | ReadDoubleRounded (TResult &aError) |
| CT_IMPORT TResult | ReadLine (uint8 *aBuffer, int32 aMaxBytes, int32 &aActualBytes) |
| CT_IMPORT TResult | ReadNullTerminatedBytes (const uint8 *&aBuffer, int32 &aLength, bool &aNullFound) |
| CT_IMPORT TResult | ReadBytes (uint8 *aBuffer, int32 aMaxBytes, int32 &aActualBytes) |
| CT_IMPORT TResult | ReadNullTerminatedString (CString &aString) |
| TResult | ReadString (MString &aString, int32 *aBytesRead=0) |
| CT_IMPORT TResult | ReadUtf8String (MString &aString, int32 *aBytesRead=0) |
| CT_IMPORT TResult | ReadUtf16String (MString &aString, int32 *aBytesRead=0) |
| CT_IMPORT TResult | Skip (int32 aBytes) |
| const uint8 * | Read (int32 aBytes) |
A data input stream. It reads integers, strings and blocks of data from a data source provided by a class derived from MInputStream.
| CartoType::TDataInputStream::TDataInputStream | ( | MInputStream & | aInputStream | ) | [inline] |
Construct a data input stream, specifying the data source.
| const uint8* CartoType::TDataInputStream::Read | ( | int32 | aBytes | ) | [inline] |
Read the next aBytes bytes, returning a pointer to them, or return NULL if fewer than that number of bytes is cached.
| CT_EXPORT TResult TDataInputStream::ReadBytes | ( | uint8 * | aBuffer, |
| int32 | aMaxBytes, | ||
| int32 & | aActualBytes | ||
| ) |
Read up to aMaxBytes to a buffer supplied and owned by the caller. This function only reads fewer than aMaxBytes if there are not enough bytes available in the stream.
Read IEEE double precision float from input stream and convert to 16.16 fixed point.
| CT_EXPORT double TDataInputStream::ReadDoubleFP | ( | TResult & | aError | ) |
Read IEEE double precision float from input stream.
| CT_EXPORT int32 TDataInputStream::ReadDoubleRounded | ( | TResult & | aError | ) |
Read IEEE double precision float from input stream and and round to 4 byte integer.
Read IEEE double precision float from input stream and convert to 16.16 fixed point representing 64ths.
| TFixed CartoType::TDataInputStream::ReadFixed | ( | TResult & | aError, |
| int32 | aFractionalBits = 16 |
||
| ) | [inline] |
Read a fixed point number from the input stream.
Read IEEE single precision float from input stream and convert to 16.16 fixed point.
| CT_EXPORT int32 TDataInputStream::ReadFloatRounded | ( | TResult & | aError | ) |
Read IEEE single precision float from input stream and round to 4 byte integer.
| CT_EXPORT TResult TDataInputStream::ReadLine | ( | uint8 * | aBuffer, |
| int32 | aMaxBytes, | ||
| int32 & | aActualBytes | ||
| ) |
Read a line of text into a buffer supplied and owned by the caller. Read up to aMaxBytes, stopping beforehand if the stream ends or a newline is encountered, defined as either CR, LF, or CR+LF. The newline is skipped but not appended to the buffer.
| CT_EXPORT TResult TDataInputStream::ReadNullTerminatedBytes | ( | const uint8 *& | aBuffer, |
| int32 & | aLength, | ||
| bool & | aNullFound | ||
| ) |
Read some data into a buffer owned by the underlying input stream. Data is only read up to but not including the first null terminator, and aNullFound will indicate whether a null terminator was actually found. The next read will start after the null terminator.
Read a null terminated string in the current encoding and endianness from the input stream.
| TResult CartoType::TDataInputStream::ReadString | ( | MString & | aString, |
| int32 * | aBytesRead = 0 |
||
| ) | [inline] |
Read a string preceded by its length. The length is a single byte for lengths 0...254. Greater lengths are encoded as the byte value 255 followed by a four-byte length. The current encoding and endianness are used. If aBytesRead is non-null the number of bytes read from the stream is returned there.
| CT_EXPORT uint32 TDataInputStream::ReadUint | ( | TResult & | aError, |
| int32 | aSize | ||
| ) |
Read integer with specified size.
Read a UTF16 string preceded by a length. A single byte of 0...254 is a valid length. The byte value 255 indicates that a four-byte length follows. The string may be big-endian or little-endian according to the stream's setting.If aBytesRead is non-null the number of bytes read from the stream is returned there.
Read a UTF8 string preceded by a length. A single byte of 0...254 is a valid length. The byte value 255 indicates that a four-byte length follows. If aBytesRead is non-null the number of bytes read from the stream is returned there.
| CT_EXPORT TResult TDataInputStream::Seek | ( | int32 | aPosition | ) |
Move to a specified position in the input stream.
| void CartoType::TDataInputStream::Set | ( | MInputStream & | aInputStream | ) | [inline] |
Set the data source.
| CT_EXPORT TResult TDataInputStream::Skip | ( | int32 | aBytes | ) |
Skip forward by a certain number of bytes.
1.7.5.1