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

Method push_back

src/fl/stl/json.h:747–768  ·  view source on GitHub ↗

Array push_back methods

Source from the content-addressed store, hash-verified

745
746 // Array push_back methods
747 void push_back(const json& value) FL_NOEXCEPT {
748 if (!mValue || !mValue->is_array()) {
749 mValue = fl::make_shared<json_value>(json_array{});
750 }
751 // If we're pushing to a packed array, convert it to regular json_array first
752 if (mValue->is_array() &&
753 (mValue->data.is<fl::vector<i16>>() ||
754 mValue->data.is<fl::vector<u8>>() ||
755 mValue->data.is<fl::vector<float>>())) {
756 // Convert to regular json_array (needs a copy/conversion)
757 auto arr = mValue->clone_array();
758 if (arr) {
759 mValue = fl::make_shared<json_value>(fl::move(*arr));
760 }
761 }
762 // For arrays, we need to manually handle the insertion since our indexing
763 // mechanism auto-creates elements
764 auto ptr = mValue->data.ptr<json_array>();
765 if (ptr) {
766 ptr->push_back(value.mValue);
767 }
768 }
769
770 // Create methods for compatibility
771 static json create_array() FL_NOEXCEPT { return json::array(); }

Callers 15

addMethod · 0.45
setStateMethod · 0.45
getStateMethod · 0.45
getPlaylistConfigMethod · 0.45
rgbToHexFunction · 0.45
parseSegmentFieldsFunction · 0.45
recordResultMethod · 0.45
updateMethod · 0.45
methodsMethod · 0.45
warningMethod · 0.45
addWarningMethod · 0.45
mergeMethod · 0.45

Calls 2

is_arrayMethod · 0.45
clone_arrayMethod · 0.45

Tested by 15

setCustomGainsMethod · 0.36
registerTestMethod · 0.36
enterSubcaseMethod · 0.36
markFullyTraversedMethod · 0.36
testCaseEndMethod · 0.36
assertResultMethod · 0.36
subcaseStartMethod · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
populateFunction · 0.36