Mercurial > hg > svcore
comparison base/EventSeries.h @ 1833:21c792334c2e sensible-delimited-data-strings
Rewrite all the DelimitedDataString stuff so as to return vectors of individual cell strings rather than having the classes add the delimiters themselves. Rename accordingly to names based on StringExport. Take advantage of this in the CSV writer code so as to properly quote cells that contain delimiter characters.
author | Chris Cannam |
---|---|
date | Fri, 03 Apr 2020 17:11:05 +0100 |
parents | c546429d4c2f |
children |
comparison
equal
deleted
inserted
replaced
1832:7c92c644db20 | 1833:21c792334c2e |
---|---|
17 | 17 |
18 #include "Event.h" | 18 #include "Event.h" |
19 #include "XmlExportable.h" | 19 #include "XmlExportable.h" |
20 | 20 |
21 #include <set> | 21 #include <set> |
22 #include <string> | |
23 #include <vector> | |
22 #include <functional> | 24 #include <functional> |
23 | 25 |
24 #include <QMutex> | 26 #include <QMutex> |
25 | 27 |
26 //#define DEBUG_EVENT_SERIES 1 | 28 //#define DEBUG_EVENT_SERIES 1 |
219 QString indent, | 221 QString indent, |
220 QString extraAttributes, | 222 QString extraAttributes, |
221 Event::ExportNameOptions) const; | 223 Event::ExportNameOptions) const; |
222 | 224 |
223 /** | 225 /** |
224 * Emit a label for each column that would be written by | 226 * Return a label for each column that would be written by |
225 * toDelimitedDataString, separated by the given delimiter. | 227 * toStringExportRows. |
226 */ | 228 */ |
227 QString getDelimitedDataHeaderLine(QString delimiter, | 229 QVector<QString> |
228 DataExportOptions options, | 230 getStringExportHeaders(DataExportOptions options, |
229 Event::ExportNameOptions) const; | 231 Event::ExportNameOptions) const; |
230 | 232 |
231 /** | 233 /** |
232 * Emit events starting within the given range to a delimited | 234 * Emit events starting within the given range as string rows |
233 * (e.g. comma-separated) data format. | 235 * ready for conversion to an e.g. comma-separated data format. |
234 */ | 236 */ |
235 QString toDelimitedDataString(QString delimiter, | 237 QVector<QVector<QString>> |
236 DataExportOptions options, | 238 toStringExportRows(DataExportOptions options, |
237 sv_frame_t startFrame, | 239 sv_frame_t startFrame, |
238 sv_frame_t duration, | 240 sv_frame_t duration, |
239 sv_samplerate_t sampleRate, | 241 sv_samplerate_t sampleRate, |
240 sv_frame_t resolution, | 242 sv_frame_t resolution, |
241 Event fillEvent) const; | 243 Event fillEvent) const; |
242 | 244 |
243 private: | 245 private: |
244 mutable QMutex m_mutex; | 246 mutable QMutex m_mutex; |
245 | 247 |
246 EventSeries(const EventSeries &other, const QMutexLocker &); | 248 EventSeries(const EventSeries &other, const QMutexLocker &); |