示例#1
0
List Factory::convert(Data::Bank& bank) 
{
   List list;

   if (!bank.isEmpty()){
      Data::Bank::iterator iter;
      for (iter = bank.begin(); iter != bank.end(); ++iter) {
          list << toLayers(**iter);
      }
   }

   return list;
}
示例#2
0
文件: IQmolParser.C 项目: Tyf0n/IQmol
void IQmol::saveData(QString const& filePath, Data::Bank& data)
{
   std::ofstream ofs(filePath.toStdString().data(), std::ios_base::binary);
   if (ofs.is_open()) {
      boost::iostreams::filtering_ostream filter;
      filter.push(boost::iostreams::gzip_compressor());
      filter.push(ofs);
      boost::archive::text_oarchive outputArchive(filter);
      data.serialize(outputArchive, 0);
   }else {
      QString msg("Failed to open file for write: ");
      msg += filePath;
      m_errors.append(msg);
    }
}
示例#3
0
// Note the Bank should be a const&, but the serialize functions are declared
// non-const for some Boost-related reason.
bool IQmol::save(QString const& filePath, Data::Bank& data)
{
   std::ofstream ofs(filePath.toStdString().data(), std::ios_base::binary);
   if (ofs.is_open()) {
      boost::iostreams::filtering_ostream filter;
#ifdef Q_OS_MAC
      // Can't get this working on Windows
      filter.push(boost::iostreams::gzip_compressor());
#endif
      filter.push(ofs);
      boost::archive::text_oarchive outputArchive(filter);
      data.serialize(outputArchive, 0);
   }else {
      QString msg("Failed to open file for write: ");
      msg += filePath;
      m_errors.append(msg);
    }

    return m_errors.isEmpty();
}