[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Thu Feb 10 11:27:48 CET 2011


SVN commit 1219702 by kuemmel:

don't skip empty header columns

 M  +4 -6      asciisource.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1219701:1219702
@@ -702,12 +702,10 @@
 QStringList AsciiSource::splitHeaderLine(const QByteArray& line, AsciiSourceConfig* cfg)
 {
   QStringList parts;
-  const QString columnDelimiter = cfg->_columnDelimiter.value();
-  const QRegExp regexS("\\s");
-  const QRegExp regexColumnDelimiter(QString("[%1]").arg(QRegExp::escape(columnDelimiter)));
+  const QRegExp regexColumnDelimiter(QString("[%1]").arg(QRegExp::escape(cfg->_columnDelimiter.value())));
 
-  if (cfg->_columnType == AsciiSourceConfig::Custom && !columnDelimiter.isEmpty()) {
-    parts += QString(line).trimmed().split(regexColumnDelimiter, QString::SkipEmptyParts);
+  if (cfg->_columnType == AsciiSourceConfig::Custom && !cfg->_columnDelimiter.value().isEmpty()) {
+    parts += QString(line).trimmed().split(regexColumnDelimiter, QString::KeepEmptyParts);
   } else if (cfg->_columnType == AsciiSourceConfig::Fixed) {
     int cnt = line.length() / cfg->_columnWidth;
     for (int i = 0; i < cnt; ++i) {
@@ -715,7 +713,7 @@
       parts += sub.trimmed();
     }
   } else {
-    parts += QString(line).trimmed().split(regexS, QString::SkipEmptyParts);
+    parts += QString(line).trimmed().split(QRegExp("\\s"), QString::KeepEmptyParts);
   }
   return parts;
 }


More information about the Kst mailing list