diff --git a/lib/ArduinoJson/CHANGELOG.md b/lib/ArduinoJson/CHANGELOG.md index e56fccb..1c06e10 100644 --- a/lib/ArduinoJson/CHANGELOG.md +++ b/lib/ArduinoJson/CHANGELOG.md @@ -1,6 +1,28 @@ ArduinoJson: change log ======================= +v6.21.3 (2023-07-23) +------- + +* Fix compatibility with the Blynk libary (issue #1914) +* Fix double lookup in `to()` +* Fix double call to `size()` in `serializeMsgPack()` +* Include `ARDUINOJSON_SLOT_OFFSET_SIZE` in the namespace name +* Show a link to the documentation when user passes an unsupported input type + +v6.21.2 (2023-04-12) +------- + +* Fix compatibility with the Zephyr Project (issue #1905) +* Allow using PROGMEM outside of Arduino (issue #1903) +* Set default for `ARDUINOJSON_ENABLE_PROGMEM` to `1` on AVR + +v6.21.1 (2023-03-27) +------- + +* Double speed of `DynamicJsonDocument::garbageCollect()` +* Fix compatibility with GCC 5.2 (issue #1897) + v6.21.0 (2023-03-14) ------- diff --git a/lib/ArduinoJson/README.md b/lib/ArduinoJson/README.md new file mode 100644 index 0000000..fce1bc3 --- /dev/null +++ b/lib/ArduinoJson/README.md @@ -0,0 +1,161 @@ +

+ ArduinoJson +

+ +--- + +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bblanchon/ArduinoJson/ci.yml?branch=6.x&logo=github)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x) +[![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x) +[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) +[![Coveralls branch](https://img.shields.io/coveralls/github/bblanchon/ArduinoJson/6.x?logo=coveralls)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x) +[![Arduino Library Manager](https://img.shields.io/static/v1?label=Arduino&message=v6.21.3&logo=arduino&logoColor=white&color=blue)](https://www.ardu-badge.com/ArduinoJson/6.21.3) +[![PlatformIO Registry](https://badges.registry.platformio.org/packages/bblanchon/library/ArduinoJson.svg?version=6.21.3)](https://registry.platformio.org/packages/libraries/bblanchon/ArduinoJson?version=6.21.3) +[![ESP IDF](https://img.shields.io/static/v1?label=ESP+IDF&message=v6.21.3&logo=cpu&logoColor=white&color=blue)](https://components.espressif.com/components/bblanchon/arduinojson) +[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github&color=orange)](https://github.com/bblanchon/ArduinoJson/stargazers) +[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github&color=orange)](https://github.com/sponsors/bblanchon) + +ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things). + +## Features + +* [JSON deserialization](https://arduinojson.org/v6/api/json/deserializejson/) + * [Optionally decodes UTF-16 escape sequences to UTF-8](https://arduinojson.org/v6/api/config/decode_unicode/) + * [Optionally stores links to the input buffer (zero-copy)](https://arduinojson.org/v6/api/json/deserializejson/) + * [Optionally supports comments in the input](https://arduinojson.org/v6/api/config/enable_comments/) + * [Optionally filters the input to keep only desired values](https://arduinojson.org/v6/api/json/deserializejson/#filtering) + * Supports single quotes as a string delimiter + * Compatible with [NDJSON](http://ndjson.org/) and [JSON Lines](https://jsonlines.org/) +* [JSON serialization](https://arduinojson.org/v6/api/json/serializejson/) + * [Can write to a buffer or a stream](https://arduinojson.org/v6/api/json/serializejson/) + * [Optionally indents the document (prettified JSON)](https://arduinojson.org/v6/api/json/serializejsonpretty/) +* [MessagePack serialization](https://arduinojson.org/v6/api/msgpack/serializemsgpack/) +* [MessagePack deserialization](https://arduinojson.org/v6/api/msgpack/deserializemsgpack/) +* Efficient + * [Twice smaller than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/) + * [Almost 10% faster than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/) + * [Consumes roughly 10% less RAM than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/) + * [Fixed memory allocation, no heap fragmentation](https://arduinojson.org/v6/api/jsondocument/) + * [Optionally works without heap memory (zero malloc)](https://arduinojson.org/v6/api/staticjsondocument/) + * [Deduplicates strings](https://arduinojson.org/news/2020/08/01/version-6-16-0/) +* Versatile + * Supports [custom allocators (to use external RAM chip, for example)](https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/) + * Supports [`String`](https://arduinojson.org/v6/api/config/enable_arduino_string/), [`std::string`](https://arduinojson.org/v6/api/config/enable_std_string/), and [`std::string_view`](https://arduinojson.org/v6/api/config/enable_string_view/) + * Supports [`Stream`](https://arduinojson.org/v6/api/config/enable_arduino_stream/) and [`std::istream`/`std::ostream`](https://arduinojson.org/v6/api/config/enable_std_stream/) + * Supports [Flash strings](https://arduinojson.org/v6/api/config/enable_progmem/) + * Supports [custom readers](https://arduinojson.org/v6/api/json/deserializejson/#custom-reader) and [custom writers](https://arduinojson.org/v6/api/json/serializejson/#custom-writer) + * Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/) +* Portable + * Usable on any C++ project (not limited to Arduino) + * Compatible with C++11, C++14 and C++17 + * Support for C++98/C++03 available on [ArduinoJson 6.20.x](https://github.com/bblanchon/ArduinoJson/tree/6.20.x) + * Zero warnings with `-Wall -Wextra -pedantic` and `/W4` + * [Header-only library](https://en.wikipedia.org/wiki/Header-only) + * Works with virtually any board + * Arduino boards: [Uno](https://amzn.to/38aL2ik), [Due](https://amzn.to/36YkWi2), [Micro](https://amzn.to/35WkdwG), [Nano](https://amzn.to/2QTvwRX), [Mega](https://amzn.to/36XWhuf), [Yun](https://amzn.to/30odURc), [Leonardo](https://amzn.to/36XWjlR)... + * Espressif chips: [ESP8266](https://amzn.to/36YluV8), [ESP32](https://amzn.to/2G4pRCB) + * Lolin (WeMos) boards: [D1 mini](https://amzn.to/2QUpz7q), [D1 Mini Pro](https://amzn.to/36UsGSs)... + * Teensy boards: [4.0](https://amzn.to/30ljXGq), [3.2](https://amzn.to/2FT0EuC), [2.0](https://amzn.to/2QXUMXj) + * Particle boards: [Argon](https://amzn.to/2FQHa9X), [Boron](https://amzn.to/36WgLUd), [Electron](https://amzn.to/30vEc4k), [Photon](https://amzn.to/387F9Cd)... + * Texas Instruments boards: [MSP430](https://amzn.to/30nJWgg)... + * Soft cores: [Nios II](https://en.wikipedia.org/wiki/Nios_II)... + * Tested on all major development environments + * [Arduino IDE](https://www.arduino.cc/en/Main/Software) + * [Atmel Studio](http://www.atmel.com/microsite/atmel-studio/) + * [Atollic TrueSTUDIO](https://atollic.com/truestudio/) + * [Energia](http://energia.nu/) + * [IAR Embedded Workbench](https://www.iar.com/iar-embedded-workbench/) + * [Keil uVision](http://www.keil.com/) + * [MPLAB X IDE](http://www.microchip.com/mplab/mplab-x-ide) + * [Particle](https://www.particle.io/) + * [PlatformIO](http://platformio.org/) + * [Sloeber plugin for Eclipse](https://eclipse.baeyens.it/) + * [Visual Micro](http://www.visualmicro.com/) + * [Visual Studio](https://www.visualstudio.com/) + * [Even works with online compilers like wandbox.org](https://wandbox.org/permlink/RlZSKy17DjJ6HcdN) + * [CMake friendly](https://arduinojson.org/v6/how-to/use-arduinojson-with-cmake/) +* Well designed + * [Elegant API](http://arduinojson.org/v6/example/) + * [Thread-safe](https://en.wikipedia.org/wiki/Thread_safety) + * Self-contained (no external dependency) + * `const` friendly + * [`for` friendly](https://arduinojson.org/v6/api/jsonobject/begin_end/) + * [TMP friendly](https://en.wikipedia.org/wiki/Template_metaprogramming) + * Handles [integer overflows](https://arduinojson.org/v6/api/jsonvariant/as/#integer-overflows) +* Well tested + * [Unit test coverage close to 100%](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x) + * Continuously tested on + * [Visual Studio 2017, 2019, 2022](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x) + * [GCC 5, 6, 7, 8, 9, 10, 11](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22) + * [Clang 3.8, 3.9, 4.0, 5.0, 6.0, 7, 8, 9, 10](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22) + * [Continuously fuzzed with Google OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) + * Passes all default checks of [clang-tidy](https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/) +* Well documented + * [Tutorials](https://arduinojson.org/v6/doc/deserialization/) + * [Examples](https://arduinojson.org/v6/example/) + * [How-tos](https://arduinojson.org/v6/example/) + * [FAQ](https://arduinojson.org/v6/faq/) + * [Troubleshooter](https://arduinojson.org/v6/troubleshooter/) + * [Book](https://arduinojson.org/book/) + * [Changelog](CHANGELOG.md) +* Vibrant user community + * Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories) + * [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson) + * [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed) + +## Quickstart + +### Deserialization + +Here is a program that parses a JSON document with ArduinoJson. + +```c++ +char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + +DynamicJsonDocument doc(1024); +deserializeJson(doc, json); + +const char* sensor = doc["sensor"]; +long time = doc["time"]; +double latitude = doc["data"][0]; +double longitude = doc["data"][1]; +``` + +See the [tutorial on arduinojson.org](https://arduinojson.org/v6/doc/deserialization/) + +### Serialization + +Here is a program that generates a JSON document with ArduinoJson: + +```c++ +DynamicJsonDocument doc(1024); + +doc["sensor"] = "gps"; +doc["time"] = 1351824120; +doc["data"][0] = 48.756080; +doc["data"][1] = 2.302038; + +serializeJson(doc, Serial); +// This prints: +// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} +``` + +See the [tutorial on arduinojson.org](https://arduinojson.org/v6/doc/serialization/) + +## Sponsors + +ArduinoJson is thankful to its sponsors. Please give them a visit; they deserve it! + +

+ + Programming Electronics Academy + +

+

+ + 1technophile + +

+ +If you run a commercial project that embeds ArduinoJson, think about [sponsoring the library's development](https://github.com/sponsors/bblanchon): it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community. + +If you are an individual user and want to support the development (or give a sign of appreciation), consider purchasing the book [Mastering ArduinoJson](https://arduinojson.org/book/) ❤, or simply [cast a star](https://github.com/bblanchon/ArduinoJson/stargazers) ⭐. diff --git a/lib/ArduinoJson/keywords.txt b/lib/ArduinoJson/keywords.txt new file mode 100644 index 0000000..3dff06b --- /dev/null +++ b/lib/ArduinoJson/keywords.txt @@ -0,0 +1,40 @@ +# Macros +JSON_ARRAY_SIZE KEYWORD2 +JSON_OBJECT_SIZE KEYWORD2 +JSON_STRING_SIZE KEYWORD2 + +# Free functions +deserializeJson KEYWORD2 +deserializeMsgPack KEYWORD2 +serialized KEYWORD2 +serializeJson KEYWORD2 +serializeJsonPretty KEYWORD2 +serializeMsgPack KEYWORD2 +measureJson KEYWORD2 +measureJsonPretty KEYWORD2 +measureMsgPack KEYWORD2 + +# Methods +add KEYWORD2 +as KEYWORD2 +createNestedArray KEYWORD2 +createNestedObject KEYWORD2 +get KEYWORD2 +set KEYWORD2 +to KEYWORD2 + +# Type names +DeserializationError KEYWORD1 DATA_TYPE +DynamicJsonDocument KEYWORD1 DATA_TYPE +JsonArray KEYWORD1 DATA_TYPE +JsonArrayConst KEYWORD1 DATA_TYPE +JsonDocument KEYWORD1 DATA_TYPE +JsonFloat KEYWORD1 DATA_TYPE +JsonInteger KEYWORD1 DATA_TYPE +JsonObject KEYWORD1 DATA_TYPE +JsonObjectConst KEYWORD1 DATA_TYPE +JsonString KEYWORD1 DATA_TYPE +JsonUInt KEYWORD1 DATA_TYPE +JsonVariant KEYWORD1 DATA_TYPE +JsonVariantConst KEYWORD1 DATA_TYPE +StaticJsonDocument KEYWORD1 DATA_TYPE diff --git a/lib/ArduinoJson/library.properties b/lib/ArduinoJson/library.properties new file mode 100644 index 0000000..6a285cf --- /dev/null +++ b/lib/ArduinoJson/library.properties @@ -0,0 +1,11 @@ +name=ArduinoJson +version=6.21.3 +author=Benoit Blanchon +maintainer=Benoit Blanchon +sentence=A simple and efficient JSON library for embedded C++. +paragraph=ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ fixed allocation, ✔ zero-copy, ✔ streams, ✔ filtering, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation. +category=Data Processing +url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties +architectures=* +repository=https://github.com/bblanchon/ArduinoJson.git +license=MIT diff --git a/lib/ArduinoJson/src/ArduinoJson.hpp b/lib/ArduinoJson/src/ArduinoJson.hpp index 0c8832a..2d1b0be 100644 --- a/lib/ArduinoJson/src/ArduinoJson.hpp +++ b/lib/ArduinoJson/src/ArduinoJson.hpp @@ -13,7 +13,8 @@ // Include Arduino.h before stdlib.h to avoid conflict with atexit() // https://github.com/bblanchon/ArduinoJson/pull/1693#issuecomment-1001060240 #if ARDUINOJSON_ENABLE_ARDUINO_STRING || ARDUINOJSON_ENABLE_ARDUINO_STREAM || \ - ARDUINOJSON_ENABLE_ARDUINO_PRINT || ARDUINOJSON_ENABLE_PROGMEM + ARDUINOJSON_ENABLE_ARDUINO_PRINT || \ + (ARDUINOJSON_ENABLE_PROGMEM && defined(ARDUINO)) # include #endif diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp b/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp index 1a9e9ce..d6e9aa5 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp @@ -17,10 +17,10 @@ class ElementProxy : public VariantRefBase>, public: ElementProxy(TUpstream upstream, size_t index) - : _upstream(upstream), _index(index) {} + : upstream_(upstream), index_(index) {} ElementProxy(const ElementProxy& src) - : _upstream(src._upstream), _index(src._index) {} + : upstream_(src.upstream_), index_(src.index_) {} FORCE_INLINE ElementProxy& operator=(const ElementProxy& src) { this->set(src); @@ -41,20 +41,20 @@ class ElementProxy : public VariantRefBase>, private: FORCE_INLINE MemoryPool* getPool() const { - return VariantAttorney::getPool(_upstream); + return VariantAttorney::getPool(upstream_); } FORCE_INLINE VariantData* getData() const { - return variantGetElement(VariantAttorney::getData(_upstream), _index); + return variantGetElement(VariantAttorney::getData(upstream_), index_); } FORCE_INLINE VariantData* getOrCreateData() const { - return variantGetOrAddElement(VariantAttorney::getOrCreateData(_upstream), - _index, VariantAttorney::getPool(_upstream)); + return variantGetOrAddElement(VariantAttorney::getOrCreateData(upstream_), + index_, VariantAttorney::getPool(upstream_)); } - TUpstream _upstream; - size_t _index; + TUpstream upstream_; + size_t index_; }; ARDUINOJSON_END_PRIVATE_NAMESPACE diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp b/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp index 00df67c..d208e41 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp @@ -20,32 +20,32 @@ class JsonArray : public detail::VariantOperators { typedef JsonArrayIterator iterator; // Constructs an unbound reference. - FORCE_INLINE JsonArray() : _data(0), _pool(0) {} + FORCE_INLINE JsonArray() : data_(0), pool_(0) {} // INTERNAL USE ONLY FORCE_INLINE JsonArray(detail::MemoryPool* pool, detail::CollectionData* data) - : _data(data), _pool(pool) {} + : data_(data), pool_(pool) {} // Returns a JsonVariant pointing to the array. // https://arduinojson.org/v6/api/jsonvariant/ operator JsonVariant() { - void* data = _data; // prevent warning cast-align - return JsonVariant(_pool, reinterpret_cast(data)); + void* data = data_; // prevent warning cast-align + return JsonVariant(pool_, reinterpret_cast(data)); } // Returns a read-only reference to the array. // https://arduinojson.org/v6/api/jsonarrayconst/ operator JsonArrayConst() const { - return JsonArrayConst(_data); + return JsonArrayConst(data_); } // Appends a new (null) element to the array. // Returns a reference to the new element. // https://arduinojson.org/v6/api/jsonarray/add/ JsonVariant add() const { - if (!_data) + if (!data_) return JsonVariant(); - return JsonVariant(_pool, _data->addElement(_pool)); + return JsonVariant(pool_, data_->addElement(pool_)); } // Appends a value to the array. @@ -65,9 +65,9 @@ class JsonArray : public detail::VariantOperators { // Returns an iterator to the first element of the array. // https://arduinojson.org/v6/api/jsonarray/begin/ FORCE_INLINE iterator begin() const { - if (!_data) + if (!data_) return iterator(); - return iterator(_pool, _data->head()); + return iterator(pool_, data_->head()); } // Returns an iterator following the last element of the array. @@ -79,41 +79,41 @@ class JsonArray : public detail::VariantOperators { // Copies an array. // https://arduinojson.org/v6/api/jsonarray/set/ FORCE_INLINE bool set(JsonArrayConst src) const { - if (!_data || !src._data) + if (!data_ || !src.data_) return false; - return _data->copyFrom(*src._data, _pool); + return data_->copyFrom(*src.data_, pool_); } // Compares the content of two arrays. FORCE_INLINE bool operator==(JsonArray rhs) const { - return JsonArrayConst(_data) == JsonArrayConst(rhs._data); + return JsonArrayConst(data_) == JsonArrayConst(rhs.data_); } // Removes the element at the specified iterator. // ⚠️ Doesn't release the memory associated with the removed element. // https://arduinojson.org/v6/api/jsonarray/remove/ FORCE_INLINE void remove(iterator it) const { - if (!_data) + if (!data_) return; - _data->removeSlot(it._slot); + data_->removeSlot(it.slot_); } // Removes the element at the specified index. // ⚠️ Doesn't release the memory associated with the removed element. // https://arduinojson.org/v6/api/jsonarray/remove/ FORCE_INLINE void remove(size_t index) const { - if (!_data) + if (!data_) return; - _data->removeElement(index); + data_->removeElement(index); } // Removes all the elements of the array. // ⚠️ Doesn't release the memory associated with the removed elements. // https://arduinojson.org/v6/api/jsonarray/clear/ void clear() const { - if (!_data) + if (!data_) return; - _data->clear(); + data_->clear(); } // Gets or sets the element at the specified index. @@ -133,54 +133,54 @@ class JsonArray : public detail::VariantOperators { } operator JsonVariantConst() const { - return JsonVariantConst(collectionToVariant(_data)); + return JsonVariantConst(collectionToVariant(data_)); } // Returns true if the reference is unbound. // https://arduinojson.org/v6/api/jsonarray/isnull/ FORCE_INLINE bool isNull() const { - return _data == 0; + return data_ == 0; } // Returns true if the reference is bound. // https://arduinojson.org/v6/api/jsonarray/isnull/ FORCE_INLINE operator bool() const { - return _data != 0; + return data_ != 0; } // Returns the number of bytes occupied by the array. // https://arduinojson.org/v6/api/jsonarray/memoryusage/ FORCE_INLINE size_t memoryUsage() const { - return _data ? _data->memoryUsage() : 0; + return data_ ? data_->memoryUsage() : 0; } // Returns the depth (nesting level) of the array. // https://arduinojson.org/v6/api/jsonarray/nesting/ FORCE_INLINE size_t nesting() const { - return variantNesting(collectionToVariant(_data)); + return variantNesting(collectionToVariant(data_)); } // Returns the number of elements in the array. // https://arduinojson.org/v6/api/jsonarray/size/ FORCE_INLINE size_t size() const { - return _data ? _data->size() : 0; + return data_ ? data_->size() : 0; } private: detail::MemoryPool* getPool() const { - return _pool; + return pool_; } detail::VariantData* getData() const { - return collectionToVariant(_data); + return collectionToVariant(data_); } detail::VariantData* getOrCreateData() const { - return collectionToVariant(_data); + return collectionToVariant(data_); } - detail::CollectionData* _data; - detail::MemoryPool* _pool; + detail::CollectionData* data_; + detail::MemoryPool* pool_; }; template <> diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp b/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp index 6c60e98..6a6463c 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp @@ -24,9 +24,9 @@ class JsonArrayConst : public detail::VariantOperators { // Returns an iterator to the first element of the array. // https://arduinojson.org/v6/api/jsonarrayconst/begin/ FORCE_INLINE iterator begin() const { - if (!_data) + if (!data_) return iterator(); - return iterator(_data->head()); + return iterator(data_->head()); } // Returns an iterator to the element following the last element of the array. @@ -36,18 +36,18 @@ class JsonArrayConst : public detail::VariantOperators { } // Creates an unbound reference. - FORCE_INLINE JsonArrayConst() : _data(0) {} + FORCE_INLINE JsonArrayConst() : data_(0) {} // INTERNAL USE ONLY FORCE_INLINE JsonArrayConst(const detail::CollectionData* data) - : _data(data) {} + : data_(data) {} // Compares the content of two arrays. // Returns true if the two arrays are equal. FORCE_INLINE bool operator==(JsonArrayConst rhs) const { - if (_data == rhs._data) + if (data_ == rhs.data_) return true; - if (!_data || !rhs._data) + if (!data_ || !rhs.data_) return false; iterator it1 = begin(); @@ -70,49 +70,49 @@ class JsonArrayConst : public detail::VariantOperators { // Returns the element at the specified index. // https://arduinojson.org/v6/api/jsonarrayconst/subscript/ FORCE_INLINE JsonVariantConst operator[](size_t index) const { - return JsonVariantConst(_data ? _data->getElement(index) : 0); + return JsonVariantConst(data_ ? data_->getElement(index) : 0); } operator JsonVariantConst() const { - return JsonVariantConst(collectionToVariant(_data)); + return JsonVariantConst(collectionToVariant(data_)); } // Returns true if the reference is unbound. // https://arduinojson.org/v6/api/jsonarrayconst/isnull/ FORCE_INLINE bool isNull() const { - return _data == 0; + return data_ == 0; } // Returns true if the reference is bound. // https://arduinojson.org/v6/api/jsonarrayconst/isnull/ FORCE_INLINE operator bool() const { - return _data != 0; + return data_ != 0; } // Returns the number of bytes occupied by the array. // https://arduinojson.org/v6/api/jsonarrayconst/memoryusage/ FORCE_INLINE size_t memoryUsage() const { - return _data ? _data->memoryUsage() : 0; + return data_ ? data_->memoryUsage() : 0; } // Returns the depth (nesting level) of the array. // https://arduinojson.org/v6/api/jsonarrayconst/nesting/ FORCE_INLINE size_t nesting() const { - return variantNesting(collectionToVariant(_data)); + return variantNesting(collectionToVariant(data_)); } // Returns the number of elements in the array. // https://arduinojson.org/v6/api/jsonarrayconst/size/ FORCE_INLINE size_t size() const { - return _data ? _data->size() : 0; + return data_ ? data_->size() : 0; } private: const detail::VariantData* getData() const { - return collectionToVariant(_data); + return collectionToVariant(data_); } - const detail::CollectionData* _data; + const detail::CollectionData* data_; }; template <> diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp b/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp index 3e1b752..d9048b2 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp @@ -12,110 +12,110 @@ ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE class VariantPtr { public: VariantPtr(detail::MemoryPool* pool, detail::VariantData* data) - : _variant(pool, data) {} + : variant_(pool, data) {} JsonVariant* operator->() { - return &_variant; + return &variant_; } JsonVariant& operator*() { - return _variant; + return variant_; } private: - JsonVariant _variant; + JsonVariant variant_; }; class JsonArrayIterator { friend class JsonArray; public: - JsonArrayIterator() : _slot(0) {} + JsonArrayIterator() : slot_(0) {} explicit JsonArrayIterator(detail::MemoryPool* pool, detail::VariantSlot* slot) - : _pool(pool), _slot(slot) {} + : pool_(pool), slot_(slot) {} JsonVariant operator*() const { - return JsonVariant(_pool, _slot->data()); + return JsonVariant(pool_, slot_->data()); } VariantPtr operator->() { - return VariantPtr(_pool, _slot->data()); + return VariantPtr(pool_, slot_->data()); } bool operator==(const JsonArrayIterator& other) const { - return _slot == other._slot; + return slot_ == other.slot_; } bool operator!=(const JsonArrayIterator& other) const { - return _slot != other._slot; + return slot_ != other.slot_; } JsonArrayIterator& operator++() { - _slot = _slot->next(); + slot_ = slot_->next(); return *this; } JsonArrayIterator& operator+=(size_t distance) { - _slot = _slot->next(distance); + slot_ = slot_->next(distance); return *this; } private: - detail::MemoryPool* _pool; - detail::VariantSlot* _slot; + detail::MemoryPool* pool_; + detail::VariantSlot* slot_; }; class VariantConstPtr { public: - VariantConstPtr(const detail::VariantData* data) : _variant(data) {} + VariantConstPtr(const detail::VariantData* data) : variant_(data) {} JsonVariantConst* operator->() { - return &_variant; + return &variant_; } JsonVariantConst& operator*() { - return _variant; + return variant_; } private: - JsonVariantConst _variant; + JsonVariantConst variant_; }; class JsonArrayConstIterator { friend class JsonArray; public: - JsonArrayConstIterator() : _slot(0) {} + JsonArrayConstIterator() : slot_(0) {} explicit JsonArrayConstIterator(const detail::VariantSlot* slot) - : _slot(slot) {} + : slot_(slot) {} JsonVariantConst operator*() const { - return JsonVariantConst(_slot->data()); + return JsonVariantConst(slot_->data()); } VariantConstPtr operator->() { - return VariantConstPtr(_slot->data()); + return VariantConstPtr(slot_->data()); } bool operator==(const JsonArrayConstIterator& other) const { - return _slot == other._slot; + return slot_ == other.slot_; } bool operator!=(const JsonArrayConstIterator& other) const { - return _slot != other._slot; + return slot_ != other.slot_; } JsonArrayConstIterator& operator++() { - _slot = _slot->next(); + slot_ = slot_->next(); return *this; } JsonArrayConstIterator& operator+=(size_t distance) { - _slot = _slot->next(distance); + slot_ = slot_->next(distance); return *this; } private: - const detail::VariantSlot* _slot; + const detail::VariantSlot* slot_; }; ARDUINOJSON_END_PUBLIC_NAMESPACE diff --git a/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp b/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp index aa807b5..090c98b 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp @@ -16,8 +16,8 @@ class VariantData; class VariantSlot; class CollectionData { - VariantSlot* _head; - VariantSlot* _tail; + VariantSlot* head_; + VariantSlot* tail_; public: // Must be a POD! @@ -67,7 +67,7 @@ class CollectionData { bool copyFrom(const CollectionData& src, MemoryPool* pool); VariantSlot* head() const { - return _head; + return head_; } void movePointers(ptrdiff_t stringDistance, ptrdiff_t variantDistance); diff --git a/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp b/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp index c99b524..134d5bd 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp @@ -16,13 +16,13 @@ inline VariantSlot* CollectionData::addSlot(MemoryPool* pool) { if (!slot) return 0; - if (_tail) { - ARDUINOJSON_ASSERT(pool->owns(_tail)); // Can't alter a linked array/object - _tail->setNextNotNull(slot); - _tail = slot; + if (tail_) { + ARDUINOJSON_ASSERT(pool->owns(tail_)); // Can't alter a linked array/object + tail_->setNextNotNull(slot); + tail_ = slot; } else { - _head = slot; - _tail = slot; + head_ = slot; + tail_ = slot; } slot->clear(); @@ -45,8 +45,8 @@ inline VariantData* CollectionData::addMember(TAdaptedString key, } inline void CollectionData::clear() { - _head = 0; - _tail = 0; + head_ = 0; + tail_ = 0; } template @@ -57,7 +57,7 @@ inline bool CollectionData::containsKey(const TAdaptedString& key) const { inline bool CollectionData::copyFrom(const CollectionData& src, MemoryPool* pool) { clear(); - for (VariantSlot* s = src._head; s; s = s->next()) { + for (VariantSlot* s = src.head_; s; s = s->next()) { VariantData* var; if (s->key() != 0) { JsonString key(s->key(), @@ -78,7 +78,7 @@ template inline VariantSlot* CollectionData::getSlot(TAdaptedString key) const { if (key.isNull()) return 0; - VariantSlot* slot = _head; + VariantSlot* slot = head_; while (slot) { if (stringEquals(key, adaptString(slot->key()))) break; @@ -88,13 +88,13 @@ inline VariantSlot* CollectionData::getSlot(TAdaptedString key) const { } inline VariantSlot* CollectionData::getSlot(size_t index) const { - if (!_head) + if (!head_) return 0; - return _head->next(index); + return head_->next(index); } inline VariantSlot* CollectionData::getPreviousSlot(VariantSlot* target) const { - VariantSlot* current = _head; + VariantSlot* current = head_; while (current) { VariantSlot* next = current->next(); if (next == target) @@ -132,7 +132,7 @@ inline VariantData* CollectionData::getElement(size_t index) const { inline VariantData* CollectionData::getOrAddElement(size_t index, MemoryPool* pool) { - VariantSlot* slot = _head; + VariantSlot* slot = head_; while (slot && index > 0) { slot = slot->next(); index--; @@ -154,9 +154,9 @@ inline void CollectionData::removeSlot(VariantSlot* slot) { if (prev) prev->setNext(next); else - _head = next; + head_ = next; if (!next) - _tail = prev; + tail_ = prev; } inline void CollectionData::removeElement(size_t index) { @@ -165,7 +165,7 @@ inline void CollectionData::removeElement(size_t index) { inline size_t CollectionData::memoryUsage() const { size_t total = 0; - for (VariantSlot* s = _head; s; s = s->next()) { + for (VariantSlot* s = head_; s; s = s->next()) { total += sizeof(VariantSlot) + s->data()->memoryUsage(); if (s->ownsKey()) total += strlen(s->key()) + 1; @@ -174,7 +174,7 @@ inline size_t CollectionData::memoryUsage() const { } inline size_t CollectionData::size() const { - return slotSize(_head); + return slotSize(head_); } template @@ -188,9 +188,9 @@ inline void movePointer(T*& p, ptrdiff_t offset) { inline void CollectionData::movePointers(ptrdiff_t stringDistance, ptrdiff_t variantDistance) { - movePointer(_head, variantDistance); - movePointer(_tail, variantDistance); - for (VariantSlot* slot = _head; slot; slot = slot->next()) + movePointer(head_, variantDistance); + movePointer(tail_, variantDistance); + for (VariantSlot* slot = head_; slot; slot = slot->next()) slot->movePointers(stringDistance, variantDistance); } diff --git a/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp b/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp index b33a833..ac0ea66 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp @@ -130,9 +130,13 @@ # define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 # endif -// Disable support for PROGMEM +// Enable PROGMEM support on AVR only # ifndef ARDUINOJSON_ENABLE_PROGMEM -# define ARDUINOJSON_ENABLE_PROGMEM 0 +# ifdef __AVR__ +# define ARDUINOJSON_ENABLE_PROGMEM 1 +# else +# define ARDUINOJSON_ENABLE_PROGMEM 0 +# endif # endif #endif // ARDUINO diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp index 2e97a02..1bfc393 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp @@ -26,49 +26,49 @@ class DeserializationError { }; DeserializationError() {} - DeserializationError(Code c) : _code(c) {} + DeserializationError(Code c) : code_(c) {} // Compare with DeserializationError friend bool operator==(const DeserializationError& lhs, const DeserializationError& rhs) { - return lhs._code == rhs._code; + return lhs.code_ == rhs.code_; } friend bool operator!=(const DeserializationError& lhs, const DeserializationError& rhs) { - return lhs._code != rhs._code; + return lhs.code_ != rhs.code_; } // Compare with Code friend bool operator==(const DeserializationError& lhs, Code rhs) { - return lhs._code == rhs; + return lhs.code_ == rhs; } friend bool operator==(Code lhs, const DeserializationError& rhs) { - return lhs == rhs._code; + return lhs == rhs.code_; } friend bool operator!=(const DeserializationError& lhs, Code rhs) { - return lhs._code != rhs; + return lhs.code_ != rhs; } friend bool operator!=(Code lhs, const DeserializationError& rhs) { - return lhs != rhs._code; + return lhs != rhs.code_; } // Returns true if there is an error explicit operator bool() const { - return _code != Ok; + return code_ != Ok; } // Returns internal enum, useful for switch statement Code code() const { - return _code; + return code_; } const char* c_str() const { static const char* messages[] = { "Ok", "EmptyInput", "IncompleteInput", "InvalidInput", "NoMemory", "TooDeep"}; - ARDUINOJSON_ASSERT(static_cast(_code) < + ARDUINOJSON_ASSERT(static_cast(code_) < sizeof(messages) / sizeof(messages[0])); - return messages[_code]; + return messages[code_]; } #if ARDUINOJSON_ENABLE_PROGMEM @@ -82,12 +82,12 @@ class DeserializationError { ARDUINOJSON_DEFINE_PROGMEM_ARRAY(const char*, messages, {s0, s1, s2, s3, s4, s5}); return reinterpret_cast( - detail::pgm_read(messages + _code)); + detail::pgm_read(messages + code_)); } #endif private: - Code _code; + Code code_; }; #if ARDUINOJSON_ENABLE_STD_STREAM diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp index 8857ced..3988302 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp @@ -11,34 +11,34 @@ ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE namespace DeserializationOption { class Filter { public: - explicit Filter(JsonVariantConst v) : _variant(v) {} + explicit Filter(JsonVariantConst v) : variant_(v) {} bool allow() const { - return _variant; + return variant_; } bool allowArray() const { - return _variant == true || _variant.is(); + return variant_ == true || variant_.is(); } bool allowObject() const { - return _variant == true || _variant.is(); + return variant_ == true || variant_.is(); } bool allowValue() const { - return _variant == true; + return variant_ == true; } template Filter operator[](const TKey& key) const { - if (_variant == true) // "true" means "allow recursively" + if (variant_ == true) // "true" means "allow recursively" return *this; - JsonVariantConst member = _variant[key]; - return Filter(member.isNull() ? _variant["*"] : member); + JsonVariantConst member = variant_[key]; + return Filter(member.isNull() ? variant_["*"] : member); } private: - JsonVariantConst _variant; + JsonVariantConst variant_; }; } // namespace DeserializationOption diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp index 6d2f675..6434275 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp @@ -12,20 +12,20 @@ ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE namespace DeserializationOption { class NestingLimit { public: - NestingLimit() : _value(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} - explicit NestingLimit(uint8_t n) : _value(n) {} + NestingLimit() : value_(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} + explicit NestingLimit(uint8_t n) : value_(n) {} NestingLimit decrement() const { - ARDUINOJSON_ASSERT(_value > 0); - return NestingLimit(static_cast(_value - 1)); + ARDUINOJSON_ASSERT(value_ > 0); + return NestingLimit(static_cast(value_ - 1)); } bool reached() const { - return _value == 0; + return value_ == 0; } private: - uint8_t _value; + uint8_t value_; }; } // namespace DeserializationOption diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp index e52af6d..4443768 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp @@ -15,18 +15,20 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template struct Reader { public: - Reader(TSource& source) : _source(&source) {} + Reader(TSource& source) : source_(&source) {} int read() { - return _source->read(); // Error here? You passed an unsupported input type + // clang-format off + return source_->read(); // Error here? See https://arduinojson.org/v6/invalid-input/ + // clang-format on } size_t readBytes(char* buffer, size_t length) { - return _source->readBytes(buffer, length); + return source_->readBytes(buffer, length); } private: - TSource* _source; + TSource* source_; }; template diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp index ac4f212..8a87388 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp @@ -12,20 +12,20 @@ template struct Reader::value>::type> { public: - explicit Reader(Stream& stream) : _stream(&stream) {} + explicit Reader(Stream& stream) : stream_(&stream) {} int read() { - // don't use _stream.read() as it ignores the timeout + // don't use stream_.read() as it ignores the timeout char c; - return _stream->readBytes(&c, 1) ? static_cast(c) : -1; + return stream_->readBytes(&c, 1) ? static_cast(c) : -1; } size_t readBytes(char* buffer, size_t length) { - return _stream->readBytes(buffer, length); + return stream_->readBytes(buffer, length); } private: - Stream* _stream; + Stream* stream_; }; ARDUINOJSON_END_PRIVATE_NAMESPACE diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp index da6880d..97714af 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp @@ -4,51 +4,51 @@ #pragma once -#include +#include ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <> struct Reader { - const char* _ptr; + const char* ptr_; public: explicit Reader(const __FlashStringHelper* ptr) - : _ptr(reinterpret_cast(ptr)) {} + : ptr_(reinterpret_cast(ptr)) {} int read() { - return pgm_read_byte(_ptr++); + return pgm_read_byte(ptr_++); } size_t readBytes(char* buffer, size_t length) { - memcpy_P(buffer, _ptr, length); - _ptr += length; + memcpy_P(buffer, ptr_, length); + ptr_ += length; return length; } }; template <> struct BoundedReader { - const char* _ptr; - const char* _end; + const char* ptr_; + const char* end_; public: explicit BoundedReader(const __FlashStringHelper* ptr, size_t size) - : _ptr(reinterpret_cast(ptr)), _end(_ptr + size) {} + : ptr_(reinterpret_cast(ptr)), end_(ptr_ + size) {} int read() { - if (_ptr < _end) - return pgm_read_byte(_ptr++); + if (ptr_ < end_) + return pgm_read_byte(ptr_++); else return -1; } size_t readBytes(char* buffer, size_t length) { - size_t available = static_cast(_end - _ptr); + size_t available = static_cast(end_ - ptr_); if (available < length) length = available; - memcpy_P(buffer, _ptr, length); - _ptr += length; + memcpy_P(buffer, ptr_, length); + ptr_ += length; return length; } }; diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp index 7189079..c0ca4a7 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp @@ -8,23 +8,23 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template class IteratorReader { - TIterator _ptr, _end; + TIterator ptr_, end_; public: explicit IteratorReader(TIterator begin, TIterator end) - : _ptr(begin), _end(end) {} + : ptr_(begin), end_(end) {} int read() { - if (_ptr < _end) - return static_cast(*_ptr++); + if (ptr_ < end_) + return static_cast(*ptr_++); else return -1; } size_t readBytes(char* buffer, size_t length) { size_t i = 0; - while (i < length && _ptr < _end) - buffer[i++] = *_ptr++; + while (i < length && ptr_ < end_) + buffer[i++] = *ptr_++; return i; } }; diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp index 78d0199..eff67ba 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp @@ -21,19 +21,19 @@ struct IsCharOrVoid : IsCharOrVoid {}; template struct Reader::value>::type> { - const char* _ptr; + const char* ptr_; public: explicit Reader(const void* ptr) - : _ptr(ptr ? reinterpret_cast(ptr) : "") {} + : ptr_(ptr ? reinterpret_cast(ptr) : "") {} int read() { - return static_cast(*_ptr++); + return static_cast(*ptr_++); } size_t readBytes(char* buffer, size_t length) { for (size_t i = 0; i < length; i++) - buffer[i] = *_ptr++; + buffer[i] = *ptr_++; return length; } }; diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp index ecace42..41e0c00 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp @@ -12,19 +12,19 @@ template struct Reader::value>::type> { public: - explicit Reader(std::istream& stream) : _stream(&stream) {} + explicit Reader(std::istream& stream) : stream_(&stream) {} int read() { - return _stream->get(); + return stream_->get(); } size_t readBytes(char* buffer, size_t length) { - _stream->read(buffer, static_cast(length)); - return static_cast(_stream->gcount()); + stream_->read(buffer, static_cast(length)); + return static_cast(stream_->gcount()); } private: - std::istream* _stream; + std::istream* stream_; }; ARDUINOJSON_END_PRIVATE_NAMESPACE diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp b/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp index 1d08680..9f4d78e 100644 --- a/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp +++ b/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp @@ -12,6 +12,17 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE +// A meta-function that returns the first type of the parameter pack +// or void if empty +template +struct first_or_void { + using type = void; +}; +template +struct first_or_void { + using type = T; +}; + template