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

Method parseUnquotedHeader

io/TextReader.cpp:150–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void TextReader::parseUnquotedHeader(const std::string& header)
151{
152 auto isspecial = [](char c)
153 { return (!std::isalnum(c)); };
154
155 // If the separator wasn't provided on the command line extract it
156 // from the header line.
157 if (!m_separatorArg->set())
158 {
159 // Scan string for some character not a number or letter.
160 for (size_t i = 0; i < header.size(); ++i)
161 // Parenthesis around special to prevent macro expansion, see #3190
162 if ((isspecial)(header[i]))
163 {
164 m_separator = header[i];
165 break;
166 }
167 }
168
169 if (m_separator != ' ')
170 m_dimNames = Utils::split(header, m_separator);
171 else
172 m_dimNames = Utils::split2(header, m_separator);
173
174 for (auto& s : m_dimNames)
175 {
176 Utils::trim(s);
177 size_t cnt = Dimension::extractName(s, 0);
178 if (cnt != s.size())
179 throwError("Invalid character '" + std::string(1, s[cnt]) +
180 "' in dimension name.");
181 }
182}
183
184
185void TextReader::initialize(PointTableRef table)

Callers

nothing calls this directly

Calls 5

splitFunction · 0.85
trimFunction · 0.85
extractNameFunction · 0.85
setMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected