FastLED 3.10.6
Loading...
Searching...
No Matches

◆ push_back()

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

Definition at line 918 of file json.h.

920 {
921 if (!mValue || !mValue->is_array()) {
923 }
924 // FastLED#3588: make_shared may degrade to empty under OOM.
925 if (!mValue) { return; }
926 // If we're pushing to a packed array, convert it to regular json_array first
927 if (mValue->is_array() &&
928 (mValue->data.is<fl::vector<i16>>() ||
929 mValue->data.is<fl::vector<u8>>() ||
930 mValue->data.is<fl::vector<float>>())) {
931 // Convert to regular json_array (needs a copy/conversion)
932 auto arr = mValue->clone_array();
933 if (arr) {
935 }
936 }
937 // For arrays, we need to manually handle the insertion since our indexing
938 // mechanism auto-creates elements
939 auto ptr = mValue->data.ptr<json_array>();
940 if (ptr) {
941 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
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition move.h:28
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:414
fl::vector< fl::shared_ptr< json_value > > json_array
Definition types.h:54

References json(), fl::FL_NO_EXCEPT, fl::make_shared(), fl::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: