6 #include <boost/scoped_array.hpp>
16 static void readStringSection(std::string& s, std::istream& inputStream)
20 if (!inputStream.read(reinterpret_cast<char*>(&len),
sizeof(len)))
25 boost::scoped_array<char> buffer(
new char[length]);
26 char* bufPtr = buffer.get();
27 if (!inputStream.read(bufPtr, length))
throw IOException();
39 static void readDataSection(
BitFileData& bitFileData, std::istream& inputStream)
43 if (!inputStream.read(reinterpret_cast<char*>(&len),
sizeof(len)))
48 if ((length & 0x3) != 0)
throw Exception();
49 size_t wordCount = length >> 2;
53 if (!inputStream.read(reinterpret_cast<char*>(dataPtr), length))
56 for (
size_t i = 0; i < wordCount; ++i)
68 if (!inputStream.read(reinterpret_cast<char*>(header),
sizeof(
BITFILE_HEADER)))
75 boost::uint8_t sectionKey;
76 while (inputStream.read(reinterpret_cast<char*>(§ionKey), 1))
90 readStringSection(bitFileData.
creationDate(), inputStream);
94 readStringSection(bitFileData.
creationTime(), inputStream);
98 readDataSection(bitFileData, inputStream);