ERMsg CShapeFileIndex::Read(const string& filePath)
	{
		ERMsg msg;

		m_recordsInfo.clear();

		ifStream file;
		msg = file.open(filePath, ios::in | ios::binary);
		if (msg)
		{
			try
			{
				boost::archive::binary_iarchive io(file, boost::archive::no_header);
				msg = CShapeFileHeader::ReadHeader(m_header, io);

				if (msg)
				{
					ASSERT((m_header.GetFileLength() - 50) % 4 == 0);
					int nbRecord = ((m_header.GetFileLength() - 50) / 4);

					m_recordsInfo.resize(nbRecord);
					for (int i = 0; i < nbRecord; i++)
					{
						m_recordsInfo[i].m_offset = ReadBigEndian(io);
						m_recordsInfo[i].m_recordLength = ReadBigEndian(io);
					}
				}
			}
			catch (boost::archive::archive_exception e)
			{
				msg.ajoute(e.what());
			}

			file.close();
		}




		return msg;
	}
Esempio n. 2
0
	template <typename T> void ReadInteger(T * buf, unsigned short bitCount)
	{
		ReadBigEndian(buf, bitCount);
	};