comparison data/fileio/CSVFileReader.cpp @ 936:0c1d6de8f44b

Merge from branch warnfix_no_size_t
author Chris Cannam
date Wed, 18 Jun 2014 13:51:16 +0100
parents 59e7fe1b1003
children fae5689f7e27
comparison
equal deleted inserted replaced
917:49618f39ff09 936:0c1d6de8f44b
33 33
34 #include <iostream> 34 #include <iostream>
35 #include <map> 35 #include <map>
36 36
37 CSVFileReader::CSVFileReader(QString path, CSVFormat format, 37 CSVFileReader::CSVFileReader(QString path, CSVFormat format,
38 size_t mainModelSampleRate) : 38 int mainModelSampleRate) :
39 m_format(format), 39 m_format(format),
40 m_file(0), 40 m_file(0),
41 m_warnings(0), 41 m_warnings(0),
42 m_mainModelSampleRate(mainModelSampleRate) 42 m_mainModelSampleRate(mainModelSampleRate)
43 { 43 {
79 CSVFileReader::getError() const 79 CSVFileReader::getError() const
80 { 80 {
81 return m_error; 81 return m_error;
82 } 82 }
83 83
84 size_t 84 int
85 CSVFileReader::convertTimeValue(QString s, int lineno, size_t sampleRate, 85 CSVFileReader::convertTimeValue(QString s, int lineno, int sampleRate,
86 size_t windowSize) const 86 int windowSize) const
87 { 87 {
88 QRegExp nonNumericRx("[^0-9eE.,+-]"); 88 QRegExp nonNumericRx("[^0-9eE.,+-]");
89 int warnLimit = 10; 89 int warnLimit = 10;
90 90
91 CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); 91 CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits();
92 92
93 size_t calculatedFrame = 0; 93 int calculatedFrame = 0;
94 94
95 bool ok = false; 95 bool ok = false;
96 QString numeric = s; 96 QString numeric = s;
97 numeric.remove(nonNumericRx); 97 numeric.remove(nonNumericRx);
98 98
133 if (!m_file) return 0; 133 if (!m_file) return 0;
134 134
135 CSVFormat::ModelType modelType = m_format.getModelType(); 135 CSVFormat::ModelType modelType = m_format.getModelType();
136 CSVFormat::TimingType timingType = m_format.getTimingType(); 136 CSVFormat::TimingType timingType = m_format.getTimingType();
137 CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); 137 CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits();
138 size_t sampleRate = m_format.getSampleRate(); 138 int sampleRate = m_format.getSampleRate();
139 size_t windowSize = m_format.getWindowSize(); 139 int windowSize = m_format.getWindowSize();
140 QChar separator = m_format.getSeparator(); 140 QChar separator = m_format.getSeparator();
141 bool allowQuoting = m_format.getAllowQuoting(); 141 bool allowQuoting = m_format.getAllowQuoting();
142 142
143 if (timingType == CSVFormat::ExplicitTiming) { 143 if (timingType == CSVFormat::ExplicitTiming) {
144 if (modelType == CSVFormat::ThreeDimensionalModel) { 144 if (modelType == CSVFormat::ThreeDimensionalModel) {
167 unsigned int warnings = 0, warnLimit = 10; 167 unsigned int warnings = 0, warnLimit = 10;
168 unsigned int lineno = 0; 168 unsigned int lineno = 0;
169 169
170 float min = 0.0, max = 0.0; 170 float min = 0.0, max = 0.0;
171 171
172 size_t frameNo = 0; 172 int frameNo = 0;
173 size_t duration = 0; 173 int duration = 0;
174 size_t endFrame = 0; 174 int endFrame = 0;
175 175
176 bool haveAnyValue = false; 176 bool haveAnyValue = false;
177 bool haveEndTime = false; 177 bool haveEndTime = false;
178 bool pitchLooksLikeMIDI = true; 178 bool pitchLooksLikeMIDI = true;
179 179
180 size_t startFrame = 0; // for calculation of dense model resolution 180 int startFrame = 0; // for calculation of dense model resolution
181 bool firstEverValue = true; 181 bool firstEverValue = true;
182 182
183 std::map<QString, int> labelCountMap; 183 std::map<QString, int> labelCountMap;
184 184
185 int valueColumns = 0; 185 int valueColumns = 0;