Mercurial > hg > svcore
comparison data/fileio/CSVFormat.cpp @ 906:654990320867
Merge from 899:bc0ff66102a8
author | Chris Cannam |
---|---|
date | Wed, 07 May 2014 15:17:51 +0100 |
parents | 69cc0454ed72 |
children | 1974859baba5 |
comparison
equal
deleted
inserted
replaced
905:1f94f3776158 | 906:654990320867 |
---|---|
64 // See comment about line endings in CSVFileReader::load() | 64 // See comment about line endings in CSVFileReader::load() |
65 | 65 |
66 QString chunk = in.readLine(); | 66 QString chunk = in.readLine(); |
67 QStringList lines = chunk.split('\r', QString::SkipEmptyParts); | 67 QStringList lines = chunk.split('\r', QString::SkipEmptyParts); |
68 | 68 |
69 for (size_t li = 0; li < lines.size(); ++li) { | 69 for (int li = 0; li < lines.size(); ++li) { |
70 | 70 |
71 QString line = lines[li]; | 71 QString line = lines[li]; |
72 if (line.startsWith("#") || line == "") continue; | 72 if (line.startsWith("#") || line == "") continue; |
73 | 73 |
74 guessQualities(line, lineno); | 74 guessQualities(line, lineno); |
84 | 84 |
85 void | 85 void |
86 CSVFormat::guessSeparator(QString line) | 86 CSVFormat::guessSeparator(QString line) |
87 { | 87 { |
88 char candidates[] = { ',', '\t', ' ', '|', '/', ':' }; | 88 char candidates[] = { ',', '\t', ' ', '|', '/', ':' }; |
89 for (int i = 0; i < sizeof(candidates)/sizeof(candidates[0]); ++i) { | 89 for (int i = 0; i < int(sizeof(candidates)/sizeof(candidates[0])); ++i) { |
90 if (StringBits::split(line, candidates[i], m_allowQuoting).size() >= 2) { | 90 if (StringBits::split(line, candidates[i], m_allowQuoting).size() >= 2) { |
91 m_separator = candidates[i]; | 91 m_separator = candidates[i]; |
92 return; | 92 return; |
93 } | 93 } |
94 } | 94 } |