Exemple #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;
}
Exemple #2
0
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);
    }
}
Exemple #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();
}