MCPcopy Create free account
hub / github.com/LAStools/LAStools / HasValueDouble

Method HasValueDouble

src/wktparser.cpp:263–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263bool WktParser::HasValueDouble(const std::string& key, double& val) {
264 std::string res;
265 if (HasValueStr(key, res)) {
266 size_t pos = res.find('|');
267 try {
268 if (pos != std::string::npos) {
269 // by default try 2nd value in values (1st is usually text)
270 val = std::stod(res.substr(pos + 1, 999));
271 } else {
272 // if only one value: try this
273 val = std::stod(res);
274 }
275 return true;
276 } catch (const std::exception&) {
277 return false;
278 }
279 } else {
280 return false;
281 }
282}
283
284int WktParser::ValueInt(const std::string& key, const double def) {
285 int ret;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected