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

Function write_csv_row

src/lasinfo.cpp:278–295  ·  view source on GitHub ↗

Write a csv line for a FileMap according to the keys

Source from the content-addressed store, hash-verified

276
277/// Write a csv line for a FileMap according to the keys
278static void write_csv_row(FILE* file_out, const FileMap& file, const std::vector<std::string>& keys) {
279 for (size_t i = 0; i < keys.size(); ++i) {
280 const std::string& key = keys[i];
281
282 // find the appropriate entry
283 auto it = std::find_if(file.begin(), file.end(), [&](const auto& kv) { return kv.first == key; });
284
285 if (it != file.end()) {
286 std::visit(CsvValueWriter{file_out}, it->second);
287 } else {
288 // empty field if key does not exist
289 }
290
291 if (i + 1 < keys.size()) fprintf(file_out, ";");
292 }
293
294 fprintf(file_out, "\n");
295}
296
297
298// A group of keys that belong together

Callers 1

write_full_csvFunction · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected