void LocalMailFolder::loadIndex() { // debug //qDebug("mailfolder: [%s] is reading index...", (const char *)name()); IndexClass *tindex = 0L; QFile f(getIndexFileName()); QDataStream stream(&f); // check index version number if (f.open(IO_ReadOnly)) { QString idxExpectedVersion(AQ_VERSION); QString idxVersion; stream>>idxVersion; if (idxExpectedVersion!=idxVersion) { qDebug("Folder %s attempted to read an older version or invalid index\ cache, discarding index...", (const char *)name()); } else {
static std::vector<FastInterval> buildIndex(std::string const & filename, uint64_t const steps = 1) { std::string const indexfilename = getIndexFileName(filename,steps); if ( ::libmaus2::util::GetFileSize::fileExists ( indexfilename ) ) { libmaus2::aio::InputStreamInstance istr(indexfilename); std::vector < FastInterval > intervals = ::libmaus2::fastx::FastInterval::deserialiseVector(istr); return intervals; } else { reader_type reader(filename); std::vector<FastInterval> intervals = reader.enumerateOffsets(steps); libmaus2::aio::OutputStreamInstance ostr(indexfilename); FastInterval::serialiseVector(ostr,intervals); ostr.flush(); return intervals; } }