MCPcopy Create free account
hub / github.com/FastLED/FastLED / contains

Method contains

src/fl/stl/json/types.h:1434–1455  ·  view source on GitHub ↗

Contains methods for checking existence

Source from the content-addressed store, hash-verified

1432
1433 // Contains methods for checking existence
1434 bool contains(size_t idx) const FL_NOEXCEPT {
1435 // Handle regular json_array first
1436 if (data.is<json_array>()) {
1437 auto ptr = data.ptr<json_array>();
1438 return ptr && idx < ptr->size();
1439 }
1440
1441 // Handle specialized array types
1442 if (data.is<fl::vector<i16>>()) {
1443 auto ptr = data.ptr<fl::vector<i16>>();
1444 return ptr && idx < ptr->size();
1445 }
1446 if (data.is<fl::vector<u8>>()) {
1447 auto ptr = data.ptr<fl::vector<u8>>();
1448 return ptr && idx < ptr->size();
1449 }
1450 if (data.is<fl::vector<float>>()) {
1451 auto ptr = data.ptr<fl::vector<float>>();
1452 return ptr && idx < ptr->size();
1453 }
1454 return false;
1455 }
1456
1457 bool contains(const fl::string &key) const FL_NOEXCEPT {
1458 if (!is_object()) return false;

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected