コード例 #1
0
ファイル: MaskBinsData.cpp プロジェクト: rosswhitfield/mantid
/** Save the state of the mask bins to a Mantid project file
 * @return a string representing the state of the mask bins
 */
std::string MaskBinsData::saveToProject() const {
  API::TSVSerialiser tsv;
  for (const auto &binMask : m_masks) {
    API::TSVSerialiser mask;
    mask.writeLine("Range") << binMask.start << binMask.end;
    mask.writeLine("Spectra");
    for (const int spectrum : binMask.spectra) {
      mask << spectrum;
    }
    tsv.writeSection("Mask", mask.outputLines());
  }
  return tsv.outputLines();
}
コード例 #2
0
/** Save the state of the mask bins to a Mantid project file
 * @return a string representing the state of the mask bins
 */
std::string MaskBinsData::saveToProject() const {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
  API::TSVSerialiser tsv;
  for (const auto &binMask : m_masks) {
    API::TSVSerialiser mask;
    mask.writeLine("Range") << binMask.start << binMask.end;
    mask.writeLine("Spectra");
    for (auto spectrum : binMask.spectra) {
      mask << spectrum;
    }
    tsv.writeSection("Mask", mask.outputLines());
  }
  return tsv.outputLines();
#else
  throw std::runtime_error(
      "MaskBinsData::saveToProject() not implemented for Qt >= 5");
#endif
}