50#if LASS_COMPILER_TYPE == LASS_COMPILER_TYPE_MSVC
52# pragma warning(disable: 4312)
61BinaryIStream::BinaryIStream():
68BinaryIStream::~BinaryIStream()
74BinaryIStream::pos_type BinaryIStream::tellg()
const
81BinaryIStream& BinaryIStream::seekg(pos_type position)
83 clear(rdstate() & ~std::ios_base::eofbit);
93BinaryIStream& BinaryIStream::seekg(off_type offset, std::ios_base::seekdir direction)
95 clear(rdstate() & ~std::ios_base::eofbit);
98 doSeekg(offset, direction);
104#if !defined(LASS_HAVE_STDINT_H_INT8_T_IS_CHAR)
106BinaryIStream& BinaryIStream::operator>>(
char& x )
114BinaryIStream& BinaryIStream::operator>>( num::Tint8& x )
121BinaryIStream& BinaryIStream::operator>>( num::Tuint8& x )
128BinaryIStream& BinaryIStream::operator>>( num::Tint16& x )
135BinaryIStream& BinaryIStream::operator>>( num::Tuint16& x )
142BinaryIStream& BinaryIStream::operator>>( num::Tint32& x )
149BinaryIStream& BinaryIStream::operator>>( num::Tuint32& x )
156BinaryIStream& BinaryIStream::operator>>( num::Tint64& x )
163BinaryIStream& BinaryIStream::operator>>( num::Tuint64& x )
170BinaryIStream& BinaryIStream::operator>>( num::Tfloat32& x )
177BinaryIStream& BinaryIStream::operator>>( num::Tfloat64& x )
184BinaryIStream& BinaryIStream::operator>>(
bool& x)
190 x = temp ? true :
false;
197BinaryIStream& BinaryIStream::operator>>(
void*& x)
199 static_assert(
sizeof(num::TintPtr) ==
sizeof(
const void*),
"TintPtr must have same size as pointers");
200 static_assert(
sizeof(num::TintPtr) <=
sizeof(num::Tint64),
"TintPtr must be no wider than 64-bit");
205 num::TintPtr address =
static_cast<num::TintPtr
>(temp);
206 if (temp !=
static_cast<num::Tint64
>(address))
208 LASS_THROW(
"address overflow" << std::hex << temp);
210 x =
reinterpret_cast<void*
>(address);
217BinaryIStream& BinaryIStream::operator>>( std::string& x )
219 typedef std::string::size_type size_type;
224 const size_type length = num::numCast<size_type>(n);
225 std::string buffer(length,
'\0');
226 doRead(&buffer[0], length);
229 x = std::move(buffer);
237#if LASS_HAVE_WCHAR_SUPPORT
239BinaryIStream& BinaryIStream::operator>>( std::wstring& x )
245 util::utf8ToWchar( utf8.data(), utf8.length(), x );
263 return doRead(output, numBytes);
276 doRead(&temp,
sizeof(T));
279 x = num::fixEndianness(temp, endianness());
base class of binary input streams.
size_t read(void *out, size_t numberOfBytes)
read a number of bytes from stream to buffer
Base class for LASS binary streams with byte-order househoulding.
streams, binary streams, vrmlstreams, ...
Library for Assembled Shared Sources.