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

Function addMetadataEntry

pdal/XMLSchema.cpp:546–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

544{
545
546void addMetadataEntry(xmlTextWriterPtr w, const MetadataNode& input)
547{
548
549 std::function<void (const MetadataNode&) > collectMetadata = [&] (const MetadataNode& node)
550 {
551 xmlTextWriterStartElement(w, (const xmlChar*)"Metadata");
552 xmlTextWriterWriteAttribute(w, (const xmlChar*)"name", (const xmlChar*)node.name().c_str());
553 xmlTextWriterWriteAttribute(w, (const xmlChar*)"type", (const xmlChar*)node.type().c_str());
554 xmlTextWriterWriteString(w, (const xmlChar*) node.value().c_str());
555 for (auto& m : node.children())
556 if (!m.empty())
557 collectMetadata(m);
558
559 xmlTextWriterEndElement(w);
560 };
561
562 xmlTextWriterStartElementNS(w, (const xmlChar*)"pc",
563 (const xmlChar*)"metadata", NULL);
564
565 for (auto& m : input.children())
566 if (!m.empty())
567 collectMetadata(m);
568
569 xmlTextWriterEndElement(w);
570 xmlTextWriterFlush(w);
571}
572
573
574} // anonymous namespace

Callers 1

writeXmlMethod · 0.85

Calls 4

nameMethod · 0.45
typeMethod · 0.45
valueMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected