void CRecordManager::ReadRecordDoc() { ifstream iFile("Record.data",ios_base::binary | ios_base::in); if (!iFile) return; SQR_TRY uint32 uVersion = 0; iFile.read((char*)&uVersion,sizeof(uint32)); if (uVersion != RD_VERSION) { iFile.close(); DeleteFile("Record.data"); return; } int chunkNum=0; iFile.read((char*)&chunkNum,sizeof(int)); for (int i=0;i<chunkNum;++i) { int nameNum; iFile.read((char*)&nameNum,sizeof(int)); string strChunkName; strChunkName.resize(nameNum); iFile.read((char*)strChunkName.c_str(),nameNum); m_WholeRD[strChunkName] = ChunkType(); ReadChunkSubRD(iFile,m_WholeRD[strChunkName]); } if (m_strChunk != "" && m_WholeRD.count(m_strChunk)) { m_mapRecord = m_WholeRD[m_strChunk]; } SQR_CATCH(exp) { string strMsg = "读取转换文档信息出错"; strMsg = strMsg + exp.ErrorTitle(); CleanRecordData(); iFile.close(); } SQR_TRY_END iFile.close(); }
void ChunkType::clear() { *this = ChunkType(); }