| 160 | } |
| 161 | |
| 162 | std::string extractTag(NL::json& node, TagMap& tags) |
| 163 | { |
| 164 | std::string tag; |
| 165 | |
| 166 | auto it = node.find("tag"); |
| 167 | if (it != node.end()) |
| 168 | { |
| 169 | NL::json& val = *it; |
| 170 | if (!val.is_null()) |
| 171 | { |
| 172 | if (val.is_string()) |
| 173 | { |
| 174 | tag = val.get<std::string>(); |
| 175 | if (tags.find(tag) != tags.end()) |
| 176 | throw pdal_error("JSON pipeline: duplicate tag '" + |
| 177 | tag + "'."); |
| 178 | } |
| 179 | else |
| 180 | throw pdal_error("JSON pipeline: tag must be " |
| 181 | "specified as a string."); |
| 182 | } |
| 183 | node.erase(it); |
| 184 | std::string::size_type pos = 0; |
| 185 | if (!Stage::parseTagName(tag, pos) || pos != tag.size()) |
| 186 | throw pdal_error("JSON pipeline: Invalid tag name '" + tag + "'. " |
| 187 | "Must start with letter. Remainder can be letters, " |
| 188 | "digits or underscores."); |
| 189 | } |
| 190 | return tag; |
| 191 | } |
| 192 | |
| 193 | FileSpec extractFilename(NL::json& node) |
| 194 | { |
no test coverage detected