Mercurial > hg > svcore
diff transform/CSVFeatureWriter.cpp @ 514:6acdddf6f99e
* fixes to improve the utility of the CSV feature writer
author | Chris Cannam |
---|---|
date | Wed, 10 Dec 2008 13:21:10 +0000 |
parents | fdf5930b7ccc |
children | 4541581067f3 |
line wrap: on
line diff
--- a/transform/CSVFeatureWriter.cpp Wed Dec 10 12:39:32 2008 +0000 +++ b/transform/CSVFeatureWriter.cpp Wed Dec 10 13:21:10 2008 +0000 @@ -85,10 +85,24 @@ for (unsigned int i = 0; i < features.size(); ++i) { + if (m_stdout || m_singleFileName != "") { + if (trackId != m_prevPrintedTrackId) { + stream << "\"" << trackId << "\"" << m_separator; + m_prevPrintedTrackId = trackId; + } else { + stream << m_separator; + } + } + QString timestamp = features[i].timestamp.toString().c_str(); timestamp.replace(QRegExp("^ +"), ""); + stream << timestamp; - stream << timestamp; + if (features[i].hasDuration) { + QString duration = features[i].duration.toString().c_str(); + duration.replace(QRegExp("^ +"), ""); + stream << m_separator << duration; + } if (summaryType != "") { stream << m_separator << summaryType.c_str(); @@ -98,6 +112,10 @@ stream << m_separator << features[i].values[j]; } + if (features[i].label != "") { + stream << m_separator << "\"" << features[i].label.c_str() << "\""; + } + stream << "\n"; } }