52  if(!file.open(QFile::ReadOnly | QFile::Text))
 
   54      qDebug() << 
"Failed to open file" << 
m_fileName;
 
   63  QString regexp_pattern = QString(
"^(%1)").arg(
 
   67  regexp_pattern += QString(
",([+-])");
 
   69  regexp_pattern += QString(
",(ESI|MALDI)");
 
   72  regexp_pattern += QString(
",ms(\\d)");
 
   75  regexp_pattern += QString(
",(-)");
 
   78  regexp_pattern += QString(
",(profile|line)");
 
   89  regexp_pattern += QString(
",(\\d+)");
 
   91  regexp_pattern += QString(
"(.*$)");
 
   95  QRegularExpression line_regexp(regexp_pattern);
 
   97  QRegularExpressionMatch regexp_match;
 
  100  bool file_reading_failed = 
false;
 
  109  std::size_t iter = 0;
 
  113      line = file.readLine().trimmed();
 
  120      if(
line.startsWith(
'#') || 
line.isEmpty() ||
 
  127      regexp_match = line_regexp.match(
line);
 
  129      if(regexp_match.hasMatch())
 
  133          regexp_match.captured(1).toDouble(&ok);
 
  137                << 
"Failed to extract the retention time of the mass spectrum.";
 
  139              file_reading_failed = 
true;
 
  144          QString ionization_mode = regexp_match.captured(2);
 
  145          QString source_type     = regexp_match.captured(3);
 
  147          regexp_match.captured(4).toInt(&ok);
 
  151                << 
"Failed to extract the MS level of the mass spectrum.";
 
  153              file_reading_failed = 
true;
 
  158          QString peak_shape_type = regexp_match.captured(6);
 
  160          QString mz_range = regexp_match.captured(7);
 
  162          mz_range.left(mz_range.indexOf(
"-")).toDouble(&ok);
 
  165              qDebug() << 
"Failed to extract the start of the m/z range.";
 
  167              file_reading_failed = 
true;
 
  172          mz_range.right(mz_range.indexOf(
"-") + 1).toDouble(&ok);
 
  175              qDebug() << 
"Failed to extract the end of the m/z range.";
 
  177              file_reading_failed = 
true;
 
  186          int peak_count = regexp_match.captured(8).toInt(&ok);
 
  189              qDebug() << 
"Failed to extract the number of peaks in the mass " 
  192              file_reading_failed = 
true;
 
  197          QString peaks                = regexp_match.captured(9);
 
  198          QStringList peaks_stringlist = peaks.split(
",", Qt::SkipEmptyParts);
 
  203          if(peaks_stringlist.size() != peak_count)
 
  209              file_reading_failed = 
true;
 
  233          qDebug() << 
"The match failed.";
 
  234          file_reading_failed = 
true;
 
  244  if(!file_reading_failed && line_count >= 1)