Mercurial > hg > svcore
comparison data/fileio/CSVStreamWriter.h @ 1449:deabf9fd3d28 streaming-csv-writer
Add failing test case for writing a sparse model. Partially handle some of the related issues with line-breaks.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Tue, 17 Apr 2018 10:03:51 +0100 |
parents | 5bd240517c1a |
children | 6e9615bde1f9 |
comparison
equal
deleted
inserted
replaced
1448:8305d442d1f7 | 1449:deabf9fd3d28 |
---|---|
66 while (readPtr < endFrame) { | 66 while (readPtr < endFrame) { |
67 if (wasCancelled()) return false; | 67 if (wasCancelled()) return false; |
68 | 68 |
69 const auto start = readPtr; | 69 const auto start = readPtr; |
70 const auto end = std::min(start + blockSize, endFrame); | 70 const auto end = std::min(start + blockSize, endFrame); |
71 | 71 const auto data = model.toDelimitedDataStringSubsetWithOptions( |
72 oss << model.toDelimitedDataStringSubsetWithOptions( | |
73 delimiter, | 72 delimiter, |
74 options, | 73 options, |
75 start, | 74 start, |
76 end | 75 end |
77 ) << (end < finalFrameOfLastRegion ? "\n" : ""); | 76 ).trimmed(); |
77 | |
78 if ( data != "" ) { | |
79 oss << data << (end < finalFrameOfLastRegion ? "\n" : ""); | |
80 } | |
81 | |
78 nFramesWritten += end - start; | 82 nFramesWritten += end - start; |
79 const auto currentProgress = 100 * nFramesWritten / nFramesToWrite; | 83 const auto currentProgress = 100 * nFramesWritten / nFramesToWrite; |
80 const bool hasIncreased = currentProgress > previousProgress; | 84 const bool hasIncreased = currentProgress > previousProgress; |
81 if (hasIncreased) { | 85 if (hasIncreased) { |
82 if (reporter) reporter->setProgress(currentProgress); | 86 if (reporter) reporter->setProgress(currentProgress); |