FastLED 3.10.9
Loading...
Searching...
No Matches

◆ push_back()

void fl::json::push_back ( const json & value)
inline

Definition at line 925 of file json.h.

927 {
928 if (!mValue || !mValue->is_array()) {
930 }
931 // FastLED#3588: make_shared may degrade to empty under OOM.
932 if (!mValue) { return; }
933 // If we're pushing to a packed array, convert it to regular json_array first
934 if (mValue->is_array() &&
935 (mValue->data.is<fl::vector<i16>>() ||
936 mValue->data.is<fl::vector<u8>>() ||
937 mValue->data.is<fl::vector<float>>())) {
938 // Convert to regular json_array (needs a copy/conversion)
939 auto arr = mValue->clone_array();
940 if (arr) {
942 }
943 }
944 // For arrays, we need to manually handle the insertion since our indexing
945 // mechanism auto-creates elements
946 auto ptr = mValue->data.ptr<json_array>();
947 if (ptr) {
948 ptr->push_back(value.mValue);
fl::shared_ptr< json_value > mValue
Definition json.h:263
T value() const FL_NO_EXCEPT
Definition json.h:497
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:423
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition s16x16x4.h:30
fl::vector< fl::shared_ptr< json_value > > json_array
Definition types.h:54

References json(), fl::FL_NO_EXCEPT, fl::adl_barrier::make_shared(), fl::fl::adl_barrier::move(), mValue, and value().

Referenced by fl::detail::MethodSchema< R(Args...)>::addParams(), fl::detail::MethodSchema< void(Args...)>::addParams(), autoresearch::flex_io::buildDeviceInfo(), fl::detail::TypeToJson< fl::vector< T > >::convert(), fl::crgbToJson(), fl::WLED::getPlaylistConfig(), fl::WLED::getState(), fl::Rpc::handle(), fl::Rpc::methods(), sendAsyncRequest(), sendAsyncStreamRequest(), sendSyncRequest(), and fl::ScreenMap::toJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: