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

Function subnodesToJSON

pdal/PDALUtils.cpp:63–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61void arrayToJSON(const MetadataNodeList& children, std::ostream& o, int level);
62void arrayEltToJSON(const MetadataNode& m, std::ostream& o, int level);
63void subnodesToJSON(const MetadataNode& parent, std::ostream& o, int level)
64{
65 const std::string indent(level * 2, ' ');
66
67 std::vector<std::string> names = parent.childNames();
68
69 o << indent << "{" << endl;
70 for (auto ni = names.begin(); ni != names.end(); ++ni)
71 {
72 MetadataNodeList children = parent.children(*ni);
73
74 MetadataNode& node = *children.begin();
75 if (node.kind() == MetadataType::Array)
76 {
77 o << indent << " \"" << node.name() << "\":" << std::endl;
78 arrayToJSON(children, o, level + 1);
79 }
80 else
81 toJSON(node, o, level + 1);
82 if (ni != names.rbegin().base() - 1)
83 o << ",";
84 o << std::endl;
85 }
86 o << indent << "}";
87}
88
89void arrayToJSON(const MetadataNodeList& children, std::ostream& o, int level)
90{

Callers 2

arrayEltToJSONFunction · 0.85
toJSONFunction · 0.85

Calls 6

arrayToJSONFunction · 0.85
toJSONFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
nameMethod · 0.45
baseMethod · 0.45

Tested by

no test coverage detected