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

Function matchProperty

io/private/stac/Item.cpp:212–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212bool matchProperty(std::string key, NL::json val, NL::json properties,
213 NL::detail::value_t type)
214{
215 switch (type)
216 {
217 case NL::detail::value_t::string:
218 {
219 std::string desired = Utils::jsonValue<std::string>(val);
220 std::string value = Utils::jsonValue<std::string>(properties, key);
221 return value == desired;
222 break;
223 }
224 case NL::detail::value_t::number_unsigned:
225 {
226 uint64_t value = Utils::jsonValue<uint64_t>(properties, key);
227 uint64_t desired = Utils::jsonValue<uint64_t>(val);
228 return value == desired;
229 break;
230 }
231 case NL::detail::value_t::number_integer:
232 {
233 int value = Utils::jsonValue<int>(properties,key);
234 int desired = Utils::jsonValue<int>(val);
235 return value == desired;
236 break;
237 }
238 case NL::detail::value_t::number_float:
239 {
240 double value = Utils::jsonValue<double>(properties, key);
241 double desired = Utils::jsonValue<double>(val);
242 return value == desired;
243 break;
244 }
245 case NL::detail::value_t::boolean:
246 {
247 bool value = Utils::jsonValue<bool>(properties, key);
248 bool desired = Utils::jsonValue<bool>(val);
249 return value == desired;
250 break;
251 }
252 default:
253 {
254 throw pdal_error("Data type of " + key +
255 " is not supported for filtering.");
256 }
257 }
258 return true;
259}
260
261
262

Callers 1

filterPropertiesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected