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

Method writeField

plugins/nitf/io/MetadataReader.cpp:115–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114
115void MetadataReader::writeField(const std::string& parentkey,
116 const std::string& key,
117 ::nitf::Field field)
118{
119 std::string v;
120
121 if (field.getType() == (::nitf::Field::FieldType)NITF_BCS_A)
122 {
123 v = field.toString();
124 }
125 else if (field.getType() == (::nitf::Field::FieldType)NITF_BCS_N)
126 {
127 v = field.toString();
128 }
129 else if (field.getType() == (::nitf::Field::FieldType)NITF_BINARY)
130 {
131 if (key == "FBKGC")
132 {
133 // special case: field is three distinct bytes
134 std::string t = field.toString();
135 v = std::to_string((unsigned int)t[0]) + ", " +
136 std::to_string((unsigned int)t[1]) + ", " +
137 std::to_string((unsigned int)t[2]);
138 }
139 else
140 {
141 v = "(binary)";
142 }
143 }
144 else
145 {
146 throw error("error reading nitf (2)");
147 }
148
149 Utils::trim(v);
150 const bool blank = (v.length() == 0);
151 if (!blank || (blank && m_showEmptyFields))
152 {
153 m_node.add<std::string>(parentkey + "." + key, v);
154 }
155
156 return;
157}
158
159
160void MetadataReader::writeInt(const std::string& parentkey,

Callers

nothing calls this directly

Calls 5

trimFunction · 0.85
errorClass · 0.70
getTypeMethod · 0.45
toStringMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected