MCPcopy Create free account
hub / github.com/bblanchon/ArduinoJson / addValue

Method addValue

src/ArduinoJson/Array/ArrayImpl.hpp:60–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59template <typename T>
60inline bool ArrayData::addValue(const T& value, ResourceManager* resources) {
61 ARDUINOJSON_ASSERT(resources != nullptr);
62 auto slot = resources->allocVariant();
63 if (!slot)
64 return false;
65 JsonVariant variant(slot.ptr(), resources);
66 if (!variant.set(value)) {
67 resources->freeVariant(slot);
68 return false;
69 }
70 CollectionData::appendOne(slot, resources);
71 return true;
72}
73
74// Returns the size (in bytes) of an array with n elements.
75constexpr size_t sizeofArray(size_t n) {

Callers 2

addFunction · 0.45
addValueFunction · 0.45

Calls 4

allocVariantMethod · 0.80
ptrMethod · 0.80
setMethod · 0.80
freeVariantMethod · 0.80

Tested by

no test coverage detected