MCPcopy Create free account
hub / github.com/PDAL/PDAL / parseQuotedHeader

Method parseQuotedHeader

io/TextReader.cpp:116–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115
116void TextReader::parseQuotedHeader(const std::string& header)
117{
118 // We know there's a double quote at position 0.
119 std::string::size_type pos = 1;
120 while (true)
121 {
122 size_t count = Dimension::extractName(header, pos);
123 m_dimNames.push_back(header.substr(pos, count));
124 pos += count;
125 if (header[pos] != '"')
126 throwError("Invalid character '" + std::string(1, header[pos]) +
127 "' found while parsing quoted header line.");
128 pos++; // Skip ending quote.
129
130 // Skip everything other than a double quote.
131 count = Utils::extract(header, pos, [](char c){ return c != '"'; });
132
133 // Find a separator.
134 if (!m_separatorArg->set())
135 {
136 std::string sep = header.substr(pos, count);
137 Utils::trim(sep);
138 if (sep.size() > 1)
139 throwError("Found separator longer than a single character.");
140 if (sep.size() == 0)
141 sep = ' ';
142 m_separatorArg->setValue(sep);
143 }
144 pos += count;
145 if (header[pos++] != '"')
146 break;
147 }
148}
149
150void TextReader::parseUnquotedHeader(const std::string& header)
151{

Callers

nothing calls this directly

Calls 5

extractNameFunction · 0.85
trimFunction · 0.85
setMethod · 0.45
sizeMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected