mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 00:32:37 +01:00 
			
		
		
		
	Replace ARDUINOJSON_NAMESPACE with an inline namespace (#1820)
				
					
				
			This commit is contained in:
		| @@ -5,6 +5,7 @@ HEAD | ||||
| ---- | ||||
|  | ||||
| * Drop support for C++98/C++03. Minimum required is C++11. | ||||
| * Remove `ARDUINOJSON_NAMESPACE`; use `ArduinoJson` instead. | ||||
|  | ||||
| v6.20.1 (2023-02-08) | ||||
| ------- | ||||
|   | ||||
| @@ -9,7 +9,7 @@ static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); | ||||
|  | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 8, | ||||
| static_assert(sizeof(ArduinoJson::detail::VariantSlot) == 8, | ||||
|               "sizeof(VariantSlot)"); | ||||
|  | ||||
| void setup() {} | ||||
|   | ||||
| @@ -9,7 +9,7 @@ static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); | ||||
|  | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 16, | ||||
| static_assert(sizeof(ArduinoJson::detail::VariantSlot) == 16, | ||||
|               "sizeof(VariantSlot)"); | ||||
|  | ||||
| void setup() {} | ||||
|   | ||||
| @@ -9,7 +9,7 @@ static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); | ||||
|  | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 32, | ||||
| static_assert(sizeof(ArduinoJson::detail::VariantSlot) == 32, | ||||
|               "sizeof(VariantSlot)"); | ||||
|  | ||||
| int main() {} | ||||
|   | ||||
| @@ -9,7 +9,7 @@ static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); | ||||
|  | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 16, | ||||
| static_assert(sizeof(ArduinoJson::detail::VariantSlot) == 16, | ||||
|               "sizeof(VariantSlot)"); | ||||
|  | ||||
| int main() {} | ||||
|   | ||||
| @@ -53,7 +53,8 @@ process() | ||||
| } | ||||
|  | ||||
| simplify_namespaces() { | ||||
| 	perl -p0i -e 's|\}  // namespace ARDUINOJSON_NAMESPACE\r?\nnamespace ARDUINOJSON_NAMESPACE \{\r?\n||igs' "$1" | ||||
| 	perl -p0i -e 's|ARDUINOJSON_END_PUBLIC_NAMESPACE\r?\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\r?\n||igs' "$1" | ||||
| 	perl -p0i -e 's|ARDUINOJSON_END_PRIVATE_NAMESPACE\r?\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\r?\n||igs' "$1" | ||||
| 	rm -f "$1.bak" | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -86,7 +86,7 @@ TEST_CASE("string_view") { | ||||
|   } | ||||
| } | ||||
|  | ||||
| using ARDUINOJSON_NAMESPACE::adaptString; | ||||
| using ArduinoJson::detail::adaptString; | ||||
|  | ||||
| TEST_CASE("StringViewAdapter") { | ||||
|   std::string_view str("bravoXXX", 5); | ||||
|   | ||||
| @@ -11,8 +11,8 @@ | ||||
| #include <catch.hpp> | ||||
|  | ||||
| namespace my { | ||||
| using ARDUINOJSON_NAMESPACE::isinf; | ||||
| using ARDUINOJSON_NAMESPACE::isnan; | ||||
| using ArduinoJson::detail::isinf; | ||||
| using ArduinoJson::detail::isnan; | ||||
| }  // namespace my | ||||
|  | ||||
| TEST_CASE("deserialize an integer") { | ||||
|   | ||||
| @@ -8,8 +8,6 @@ | ||||
| #include <sstream> | ||||
| #include <utility> | ||||
|  | ||||
| using ARDUINOJSON_NAMESPACE::addPadding; | ||||
|  | ||||
| class SpyingAllocator { | ||||
|  public: | ||||
|   SpyingAllocator(const SpyingAllocator& src) : _log(src._log) {} | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using ARDUINOJSON_NAMESPACE::addPadding; | ||||
| using ArduinoJson::detail::addPadding; | ||||
|  | ||||
| static void REQUIRE_JSON(JsonDocument& doc, const std::string& expected) { | ||||
|   std::string json; | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| typedef ARDUINOJSON_NAMESPACE::ElementProxy<JsonDocument&> ElementProxy; | ||||
| typedef ArduinoJson::detail::ElementProxy<JsonDocument&> ElementProxy; | ||||
|  | ||||
| TEST_CASE("ElementProxy::add()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| typedef ARDUINOJSON_NAMESPACE::MemberProxy<JsonDocument&, const char*> | ||||
| typedef ArduinoJson::detail::MemberProxy<JsonDocument&, const char*> | ||||
|     MemberProxy; | ||||
|  | ||||
| TEST_CASE("MemberProxy::add()") { | ||||
|   | ||||
| @@ -8,8 +8,6 @@ | ||||
| #include <stdlib.h>  // malloc, free | ||||
| #include <string> | ||||
|  | ||||
| using ARDUINOJSON_NAMESPACE::addPadding; | ||||
|  | ||||
| class ArmoredAllocator { | ||||
|  public: | ||||
|   ArmoredAllocator() : _ptr(0), _size(0) {} | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #include <catch.hpp> | ||||
|  | ||||
| namespace my { | ||||
| using ARDUINOJSON_NAMESPACE::isinf; | ||||
| using ArduinoJson::detail::isinf; | ||||
| }  // namespace my | ||||
|  | ||||
| enum MY_ENUM { ONE = 1, TWO = 2 }; | ||||
|   | ||||
| @@ -88,7 +88,7 @@ class Complex { | ||||
|   double _real, _imag; | ||||
| }; | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| namespace ArduinoJson { | ||||
| template <> | ||||
| struct Converter<Complex> { | ||||
|   static void toJson(const Complex& src, JsonVariant dst) { | ||||
| @@ -104,7 +104,7 @@ struct Converter<Complex> { | ||||
|     return src["real"].is<double>() && src["imag"].is<double>(); | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| }  // namespace ArduinoJson | ||||
|  | ||||
| TEST_CASE("Custom converter with specialization") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
| @@ -142,7 +142,7 @@ TEST_CASE("Custom converter with specialization") { | ||||
| } | ||||
|  | ||||
| TEST_CASE("ConverterNeedsWriteableRef") { | ||||
|   using namespace ARDUINOJSON_NAMESPACE; | ||||
|   using namespace ArduinoJson::detail; | ||||
|   CHECK(ConverterNeedsWriteableRef<int>::value == false); | ||||
|   CHECK(ConverterNeedsWriteableRef<float>::value == false); | ||||
|   CHECK(ConverterNeedsWriteableRef<JsonVariant>::value == true); | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| namespace ArduinoJson { | ||||
| template <typename T> | ||||
| struct Converter<std::vector<T> > { | ||||
|   static void toJson(const std::vector<T>& src, JsonVariant dst) { | ||||
| @@ -63,7 +63,7 @@ struct Converter<std::array<T, N> > { | ||||
|     return result && size == N; | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| }  // namespace ArduinoJson | ||||
|  | ||||
| TEST_CASE("vector<int>") { | ||||
|   SECTION("toJson") { | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson/StringStorage/StringCopier.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("StringCopier") { | ||||
|   char buffer[4096]; | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson/Memory/MemoryPool.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("MemoryPool::allocVariant()") { | ||||
|   char buffer[4096]; | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| #include <ArduinoJson/Strings/StringAdapters.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| static const size_t poolCapacity = 512; | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| #include <ArduinoJson/Strings/StringAdapters.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| static const char* saveString(MemoryPool& pool, const char* s) { | ||||
|   return pool.saveString(adaptString(const_cast<char*>(s))); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson/Memory/MemoryPool.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("MemoryPool::capacity()") { | ||||
|   char buffer[4096]; | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson/Numbers/FloatParts.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("FloatParts<double>") { | ||||
|   SECTION("1.7976931348623157E+308") { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
| #include <sstream> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("Reader<std::istringstream>") { | ||||
|   SECTION("read()") { | ||||
|   | ||||
| @@ -14,7 +14,7 @@ | ||||
|  | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("ZeroTerminatedRamString") { | ||||
|   SECTION("null") { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
| #include <catch.hpp> | ||||
| #include "custom_string.hpp" | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| template <typename StringWriter> | ||||
| static size_t print(StringWriter& writer, const char* s) { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|  | ||||
| #include <sstream> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| class EmptyClass {}; | ||||
| enum EmptyEnum {}; | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson/Json/Utf16.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| static void testUtf16Codepoint(uint16_t codeunit, uint32_t expectedCodepoint) { | ||||
|   Utf16::Codepoint cp; | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|  | ||||
| #include <string> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| static void testCodepoint(uint32_t codepoint, std::string expected) { | ||||
|   char buffer[4096]; | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson/Numbers/arithmeticCompare.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("arithmeticCompare()") { | ||||
|   SECTION("int vs uint8_t") { | ||||
|   | ||||
| @@ -8,7 +8,8 @@ | ||||
|  | ||||
| // Issue #1198: strcmp() implementation that returns a value larger than 8-bit | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| int strcmp(const char* a, const char* b) { | ||||
|   int result = ::strcmp(a, b); | ||||
|   if (result > 0) | ||||
| @@ -26,4 +27,5 @@ int strncmp(const char* a, const char* b, size_t n) { | ||||
|     return -214748364; | ||||
|   return 0; | ||||
| } | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| #define ARDUINOJSON_NAMESPACE ArduinoJson_NoAlignment | ||||
| #define ARDUINOJSON_VERSION_NAMESPACE NoAlignment | ||||
| #define ARDUINOJSON_ENABLE_ALIGNMENT 0 | ||||
| #include <ArduinoJson.h> | ||||
|  | ||||
| #include <catch.hpp> | ||||
|  | ||||
| TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 0") { | ||||
|   using namespace ARDUINOJSON_NAMESPACE; | ||||
|   using namespace ArduinoJson::detail; | ||||
|  | ||||
|   const size_t N = sizeof(void*); | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| #include <catch.hpp> | ||||
|  | ||||
| TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 1") { | ||||
|   using namespace ARDUINOJSON_NAMESPACE; | ||||
|   using namespace ArduinoJson::detail; | ||||
|  | ||||
|   const size_t N = sizeof(void*); | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <limits> | ||||
|  | ||||
| namespace my { | ||||
| using ARDUINOJSON_NAMESPACE::isinf; | ||||
| using ArduinoJson::detail::isinf; | ||||
| }  // namespace my | ||||
|  | ||||
| TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 1") { | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <limits> | ||||
|  | ||||
| namespace my { | ||||
| using ARDUINOJSON_NAMESPACE::isnan; | ||||
| using ArduinoJson::detail::isnan; | ||||
| }  // namespace my | ||||
|  | ||||
| TEST_CASE("ARDUINOJSON_ENABLE_NAN == 1") { | ||||
|   | ||||
| @@ -53,7 +53,7 @@ TEST_CASE("Flash strings") { | ||||
| } | ||||
|  | ||||
| TEST_CASE("parseNumber()") {  // tables are in Flash | ||||
|   using ARDUINOJSON_NAMESPACE::parseNumber; | ||||
|   using ArduinoJson::detail::parseNumber; | ||||
|  | ||||
|   CHECK(parseNumber<float>("1") == 1.f); | ||||
|   CHECK(parseNumber<float>("1.23") == 1.23f); | ||||
| @@ -95,7 +95,7 @@ TEST_CASE("memcpy_P") { | ||||
| } | ||||
|  | ||||
| TEST_CASE("BoundedReader<const __FlashStringHelper*>") { | ||||
|   using namespace ARDUINOJSON_NAMESPACE; | ||||
|   using namespace ArduinoJson::detail; | ||||
|  | ||||
|   SECTION("read") { | ||||
|     BoundedReader<const __FlashStringHelper*> reader(F("\x01\xFF"), 2); | ||||
| @@ -135,7 +135,7 @@ TEST_CASE("BoundedReader<const __FlashStringHelper*>") { | ||||
| } | ||||
|  | ||||
| TEST_CASE("Reader<const __FlashStringHelper*>") { | ||||
|   using namespace ARDUINOJSON_NAMESPACE; | ||||
|   using namespace ArduinoJson::detail; | ||||
|  | ||||
|   SECTION("read()") { | ||||
|     Reader<const __FlashStringHelper*> reader(F("\x01\xFF\x00\x12")); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| template <typename T> | ||||
| static void check(const char* input, T expected) { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|  | ||||
| #include <sstream> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("deserializeMsgPack() filter") { | ||||
|   StaticJsonDocument<4096> doc; | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| #include <ArduinoJson.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("canConvertNumber<TOut, TIn>()") { | ||||
|   SECTION("int8_t -> int8_t") { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <ArduinoJson.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| void checkDouble(const char* input, double expected) { | ||||
|   CAPTURE(input); | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <ArduinoJson.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| void checkFloat(const char* input, float expected) { | ||||
|   CAPTURE(input); | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| #include <ArduinoJson.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| template <typename T> | ||||
| void checkInteger(const char* input, T expected) { | ||||
|   | ||||
| @@ -5,7 +5,8 @@ | ||||
| #include <ArduinoJson.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| TEST_CASE("Test unsigned integer overflow") { | ||||
|   VariantData first, second; | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <ArduinoJson/Json/TextFormatter.hpp> | ||||
| #include <ArduinoJson/Serialization/Writer.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| template <typename TFloat> | ||||
| void check(TFloat input, const std::string& expected) { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <ArduinoJson/Json/TextFormatter.hpp> | ||||
| #include <ArduinoJson/Serialization/Writer.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| template <typename T> | ||||
| void checkWriteInteger(T value, std::string expected) { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #include <ArduinoJson/Json/TextFormatter.hpp> | ||||
| #include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
| using namespace ArduinoJson::detail; | ||||
|  | ||||
| void check(const char* input, std::string expected) { | ||||
|   char output[64] = {0}; | ||||
|   | ||||
| @@ -49,36 +49,3 @@ | ||||
| #include "ArduinoJson/MsgPack/MsgPackSerializer.hpp" | ||||
|  | ||||
| #include "ArduinoJson/compatibility.hpp" | ||||
|  | ||||
| namespace ArduinoJson { | ||||
| using ARDUINOJSON_NAMESPACE::BasicJsonDocument; | ||||
| using ARDUINOJSON_NAMESPACE::copyArray; | ||||
| using ARDUINOJSON_NAMESPACE::DeserializationError; | ||||
| using ARDUINOJSON_NAMESPACE::deserializeJson; | ||||
| using ARDUINOJSON_NAMESPACE::deserializeMsgPack; | ||||
| using ARDUINOJSON_NAMESPACE::DynamicJsonDocument; | ||||
| using ARDUINOJSON_NAMESPACE::JsonArray; | ||||
| using ARDUINOJSON_NAMESPACE::JsonArrayConst; | ||||
| using ARDUINOJSON_NAMESPACE::JsonDocument; | ||||
| using ARDUINOJSON_NAMESPACE::JsonFloat; | ||||
| using ARDUINOJSON_NAMESPACE::JsonInteger; | ||||
| using ARDUINOJSON_NAMESPACE::JsonObject; | ||||
| using ARDUINOJSON_NAMESPACE::JsonObjectConst; | ||||
| using ARDUINOJSON_NAMESPACE::JsonPair; | ||||
| using ARDUINOJSON_NAMESPACE::JsonPairConst; | ||||
| using ARDUINOJSON_NAMESPACE::JsonString; | ||||
| using ARDUINOJSON_NAMESPACE::JsonUInt; | ||||
| using ARDUINOJSON_NAMESPACE::JsonVariant; | ||||
| using ARDUINOJSON_NAMESPACE::JsonVariantConst; | ||||
| using ARDUINOJSON_NAMESPACE::measureJson; | ||||
| using ARDUINOJSON_NAMESPACE::serialized; | ||||
| using ARDUINOJSON_NAMESPACE::serializeJson; | ||||
| using ARDUINOJSON_NAMESPACE::serializeJsonPretty; | ||||
| using ARDUINOJSON_NAMESPACE::serializeMsgPack; | ||||
| using ARDUINOJSON_NAMESPACE::StaticJsonDocument; | ||||
|  | ||||
| namespace DeserializationOption { | ||||
| using ARDUINOJSON_NAMESPACE::Filter; | ||||
| using ARDUINOJSON_NAMESPACE::NestingLimit; | ||||
| }  // namespace DeserializationOption | ||||
| }  // namespace ArduinoJson | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Variant/VariantRefBase.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| // A proxy class to get or set an element of an array. | ||||
| // https://arduinojson.org/v6/api/jsonarray/subscript/ | ||||
| @@ -57,4 +57,4 @@ class ElementProxy : public VariantRefBase<ElementProxy<TUpstream> >, | ||||
|   size_t _index; | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -7,14 +7,14 @@ | ||||
| #include <ArduinoJson/Array/ElementProxy.hpp> | ||||
| #include <ArduinoJson/Array/JsonArrayConst.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| class JsonObject; | ||||
|  | ||||
| // A reference to an array in a JsonDocument | ||||
| // https://arduinojson.org/v6/api/jsonarray/ | ||||
| class JsonArray : public VariantOperators<JsonArray> { | ||||
|   friend class VariantAttorney; | ||||
| class JsonArray : public detail::VariantOperators<JsonArray> { | ||||
|   friend class detail::VariantAttorney; | ||||
|  | ||||
|  public: | ||||
|   typedef JsonArrayIterator iterator; | ||||
| @@ -23,14 +23,14 @@ class JsonArray : public VariantOperators<JsonArray> { | ||||
|   FORCE_INLINE JsonArray() : _data(0), _pool(0) {} | ||||
|  | ||||
|   // INTERNAL USE ONLY | ||||
|   FORCE_INLINE JsonArray(MemoryPool* pool, CollectionData* data) | ||||
|   FORCE_INLINE JsonArray(detail::MemoryPool* pool, detail::CollectionData* data) | ||||
|       : _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<VariantData*>(data)); | ||||
|     return JsonVariant(_pool, reinterpret_cast<detail::VariantData*>(data)); | ||||
|   } | ||||
|  | ||||
|   // Returns a read-only reference to the array. | ||||
| @@ -118,8 +118,8 @@ class JsonArray : public VariantOperators<JsonArray> { | ||||
|  | ||||
|   // Gets or sets the element at the specified index. | ||||
|   // https://arduinojson.org/v6/api/jsonarray/subscript/ | ||||
|   FORCE_INLINE ElementProxy<JsonArray> operator[](size_t index) const { | ||||
|     return ElementProxy<JsonArray>(*this, index); | ||||
|   FORCE_INLINE detail::ElementProxy<JsonArray> operator[](size_t index) const { | ||||
|     return {*this, index}; | ||||
|   } | ||||
|  | ||||
|   // Creates an object and appends it to the array. | ||||
| @@ -167,35 +167,35 @@ class JsonArray : public VariantOperators<JsonArray> { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   MemoryPool* getPool() const { | ||||
|   detail::MemoryPool* getPool() const { | ||||
|     return _pool; | ||||
|   } | ||||
|  | ||||
|   VariantData* getData() const { | ||||
|   detail::VariantData* getData() const { | ||||
|     return collectionToVariant(_data); | ||||
|   } | ||||
|  | ||||
|   VariantData* getOrCreateData() const { | ||||
|   detail::VariantData* getOrCreateData() const { | ||||
|     return collectionToVariant(_data); | ||||
|   } | ||||
|  | ||||
|   CollectionData* _data; | ||||
|   MemoryPool* _pool; | ||||
|   detail::CollectionData* _data; | ||||
|   detail::MemoryPool* _pool; | ||||
| }; | ||||
|  | ||||
| template <> | ||||
| struct Converter<JsonArray> : private VariantAttorney { | ||||
| struct Converter<JsonArray> : private detail::VariantAttorney { | ||||
|   static void toJson(JsonVariantConst src, JsonVariant dst) { | ||||
|     variantCopyFrom(getData(dst), getData(src), getPool(dst)); | ||||
|   } | ||||
|  | ||||
|   static JsonArray fromJson(JsonVariant src) { | ||||
|     VariantData* data = getData(src); | ||||
|     MemoryPool* pool = getPool(src); | ||||
|     auto data = getData(src); | ||||
|     auto pool = getPool(src); | ||||
|     return JsonArray(pool, data != 0 ? data->asArray() : 0); | ||||
|   } | ||||
|  | ||||
|   static InvalidConversion<JsonVariantConst, JsonArray> fromJson( | ||||
|   static detail::InvalidConversion<JsonVariantConst, JsonArray> fromJson( | ||||
|       JsonVariantConst); | ||||
|  | ||||
|   static bool checkJson(JsonVariantConst) { | ||||
| @@ -203,8 +203,9 @@ struct Converter<JsonArray> : private VariantAttorney { | ||||
|   } | ||||
|  | ||||
|   static bool checkJson(JsonVariant src) { | ||||
|     VariantData* data = getData(src); | ||||
|     auto data = getData(src); | ||||
|     return data && data->isArray(); | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -8,15 +8,15 @@ | ||||
| #include <ArduinoJson/Variant/VariantAttorney.hpp> | ||||
| #include <ArduinoJson/Variant/VariantData.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| class JsonObject; | ||||
|  | ||||
| // A read-only reference to an array in a JsonDocument | ||||
| // https://arduinojson.org/v6/api/jsonarrayconst/ | ||||
| class JsonArrayConst : public VariantOperators<JsonArrayConst> { | ||||
| class JsonArrayConst : public detail::VariantOperators<JsonArrayConst> { | ||||
|   friend class JsonArray; | ||||
|   friend class VariantAttorney; | ||||
|   friend class detail::VariantAttorney; | ||||
|  | ||||
|  public: | ||||
|   typedef JsonArrayConstIterator iterator; | ||||
| @@ -39,7 +39,8 @@ class JsonArrayConst : public VariantOperators<JsonArrayConst> { | ||||
|   FORCE_INLINE JsonArrayConst() : _data(0) {} | ||||
|  | ||||
|   // INTERNAL USE ONLY | ||||
|   FORCE_INLINE JsonArrayConst(const CollectionData* data) : _data(data) {} | ||||
|   FORCE_INLINE JsonArrayConst(const detail::CollectionData* data) | ||||
|       : _data(data) {} | ||||
|  | ||||
|   // Compares the content of two arrays. | ||||
|   // Returns true if the two arrays are equal. | ||||
| @@ -107,28 +108,28 @@ class JsonArrayConst : public VariantOperators<JsonArrayConst> { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   const VariantData* getData() const { | ||||
|   const detail::VariantData* getData() const { | ||||
|     return collectionToVariant(_data); | ||||
|   } | ||||
|  | ||||
|   const CollectionData* _data; | ||||
|   const detail::CollectionData* _data; | ||||
| }; | ||||
|  | ||||
| template <> | ||||
| struct Converter<JsonArrayConst> : private VariantAttorney { | ||||
| struct Converter<JsonArrayConst> : private detail::VariantAttorney { | ||||
|   static void toJson(JsonVariantConst src, JsonVariant dst) { | ||||
|     variantCopyFrom(getData(dst), getData(src), getPool(dst)); | ||||
|   } | ||||
|  | ||||
|   static JsonArrayConst fromJson(JsonVariantConst src) { | ||||
|     const VariantData* data = getData(src); | ||||
|     auto data = getData(src); | ||||
|     return data ? data->asArray() : 0; | ||||
|   } | ||||
|  | ||||
|   static bool checkJson(JsonVariantConst src) { | ||||
|     const VariantData* data = getData(src); | ||||
|     auto data = getData(src); | ||||
|     return data && data->isArray(); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -7,12 +7,16 @@ | ||||
| #include <ArduinoJson/Array/JsonArray.hpp> | ||||
| #include <ArduinoJson/Object/JsonObject.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| inline JsonObject JsonArray::createNestedObject() const { | ||||
|   return add().to<JsonObject>(); | ||||
| } | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TDerived> | ||||
| inline JsonArray VariantRefBase<TDerived>::createNestedArray() const { | ||||
|   return add().template to<JsonArray>(); | ||||
| @@ -29,4 +33,4 @@ inline ElementProxy<TDerived> VariantRefBase<TDerived>::operator[]( | ||||
|   return ElementProxy<TDerived>(derived(), index); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -7,11 +7,12 @@ | ||||
| #include <ArduinoJson/Variant/JsonVariant.hpp> | ||||
| #include <ArduinoJson/Variant/SlotFunctions.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| class VariantPtr { | ||||
|  public: | ||||
|   VariantPtr(MemoryPool* pool, VariantData* data) : _variant(pool, data) {} | ||||
|   VariantPtr(detail::MemoryPool* pool, detail::VariantData* data) | ||||
|       : _variant(pool, data) {} | ||||
|  | ||||
|   JsonVariant* operator->() { | ||||
|     return &_variant; | ||||
| @@ -30,7 +31,8 @@ class JsonArrayIterator { | ||||
|  | ||||
|  public: | ||||
|   JsonArrayIterator() : _slot(0) {} | ||||
|   explicit JsonArrayIterator(MemoryPool* pool, VariantSlot* slot) | ||||
|   explicit JsonArrayIterator(detail::MemoryPool* pool, | ||||
|                              detail::VariantSlot* slot) | ||||
|       : _pool(pool), _slot(slot) {} | ||||
|  | ||||
|   JsonVariant operator*() const { | ||||
| @@ -59,13 +61,13 @@ class JsonArrayIterator { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   MemoryPool* _pool; | ||||
|   VariantSlot* _slot; | ||||
|   detail::MemoryPool* _pool; | ||||
|   detail::VariantSlot* _slot; | ||||
| }; | ||||
|  | ||||
| class VariantConstPtr { | ||||
|  public: | ||||
|   VariantConstPtr(const VariantData* data) : _variant(data) {} | ||||
|   VariantConstPtr(const detail::VariantData* data) : _variant(data) {} | ||||
|  | ||||
|   JsonVariantConst* operator->() { | ||||
|     return &_variant; | ||||
| @@ -84,7 +86,8 @@ class JsonArrayConstIterator { | ||||
|  | ||||
|  public: | ||||
|   JsonArrayConstIterator() : _slot(0) {} | ||||
|   explicit JsonArrayConstIterator(const VariantSlot* slot) : _slot(slot) {} | ||||
|   explicit JsonArrayConstIterator(const detail::VariantSlot* slot) | ||||
|       : _slot(slot) {} | ||||
|  | ||||
|   JsonVariantConst operator*() const { | ||||
|     return JsonVariantConst(_slot->data()); | ||||
| @@ -112,6 +115,7 @@ class JsonArrayConstIterator { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   const VariantSlot* _slot; | ||||
|   const detail::VariantSlot* _slot; | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -7,21 +7,21 @@ | ||||
| #include <ArduinoJson/Array/JsonArray.hpp> | ||||
| #include <ArduinoJson/Document/JsonDocument.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Copies a value to a JsonVariant. | ||||
| // This is a degenerated form of copyArray() to stop the recursion. | ||||
| template <typename T> | ||||
| inline typename enable_if<!is_array<T>::value, bool>::type copyArray( | ||||
|     const T& src, JsonVariant dst) { | ||||
| inline typename detail::enable_if<!detail::is_array<T>::value, bool>::type | ||||
| copyArray(const T& src, JsonVariant dst) { | ||||
|   return dst.set(src); | ||||
| } | ||||
|  | ||||
| // Copies values from an array to a JsonArray or a JsonVariant. | ||||
| // https://arduinojson.org/v6/api/misc/copyarray/ | ||||
| template <typename T, size_t N, typename TDestination> | ||||
| inline typename enable_if<!is_base_of<JsonDocument, TDestination>::value, | ||||
|                           bool>::type | ||||
| inline typename detail::enable_if< | ||||
|     !detail::is_base_of<JsonDocument, TDestination>::value, bool>::type | ||||
| copyArray(T (&src)[N], const TDestination& dst) { | ||||
|   return copyArray(src, N, dst); | ||||
| } | ||||
| @@ -29,8 +29,8 @@ copyArray(T (&src)[N], const TDestination& dst) { | ||||
| // Copies values from an array to a JsonArray or a JsonVariant. | ||||
| // https://arduinojson.org/v6/api/misc/copyarray/ | ||||
| template <typename T, typename TDestination> | ||||
| inline typename enable_if<!is_base_of<JsonDocument, TDestination>::value, | ||||
|                           bool>::type | ||||
| inline typename detail::enable_if< | ||||
|     !detail::is_base_of<JsonDocument, TDestination>::value, bool>::type | ||||
| copyArray(const T* src, size_t len, const TDestination& dst) { | ||||
|   bool ok = true; | ||||
|   for (size_t i = 0; i < len; i++) { | ||||
| @@ -63,8 +63,8 @@ inline bool copyArray(const T* src, size_t len, JsonDocument& dst) { | ||||
| // Copies a value from a JsonVariant. | ||||
| // This is a degenerated form of copyArray() to stop the recursion. | ||||
| template <typename T> | ||||
| inline typename enable_if<!is_array<T>::value, size_t>::type copyArray( | ||||
|     JsonVariantConst src, T& dst) { | ||||
| inline typename detail::enable_if<!detail::is_array<T>::value, size_t>::type | ||||
| copyArray(JsonVariantConst src, T& dst) { | ||||
|   dst = src.as<T>(); | ||||
|   return 1; | ||||
| } | ||||
| @@ -103,11 +103,12 @@ inline size_t copyArray(JsonVariantConst src, char (&dst)[N]) { | ||||
| // Copies values from a JsonDocument to an array. | ||||
| // https://arduinojson.org/v6/api/misc/copyarray/ | ||||
| template <typename TSource, typename T> | ||||
| inline typename enable_if<is_array<T>::value && | ||||
|                               is_base_of<JsonDocument, TSource>::value, | ||||
| inline typename detail::enable_if< | ||||
|     detail::is_array<T>::value && | ||||
|         detail::is_base_of<JsonDocument, TSource>::value, | ||||
|     size_t>::type | ||||
| copyArray(const TSource& src, T& dst) { | ||||
|   return copyArray(src.template as<JsonArrayConst>(), dst); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| #include <stddef.h>  // size_t | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| class MemoryPool; | ||||
| class VariantData; | ||||
| @@ -91,4 +91,5 @@ inline VariantData* collectionToVariant(CollectionData* collection) { | ||||
|   void* data = collection;  // prevent warning cast-align | ||||
|   return reinterpret_cast<VariantData*>(data); | ||||
| } | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <ArduinoJson/Strings/StringAdapters.hpp> | ||||
| #include <ArduinoJson/Variant/VariantData.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| inline VariantSlot* CollectionData::addSlot(MemoryPool* pool) { | ||||
|   VariantSlot* slot = pool->allocVariant(); | ||||
| @@ -194,4 +194,4 @@ inline void CollectionData::movePointers(ptrdiff_t stringDistance, | ||||
|     slot->movePointers(stringDistance, variantDistance); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
| #  include <ostream> | ||||
| #endif | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| class DeserializationError { | ||||
|  public: | ||||
| @@ -82,7 +82,7 @@ class DeserializationError { | ||||
|     ARDUINOJSON_DEFINE_PROGMEM_ARRAY( | ||||
|         const char*, messages, ARDUINOJSON_EXPAND6({s0, s1, s2, s3, s4, s5})); | ||||
|     return reinterpret_cast<const __FlashStringHelper*>( | ||||
|         pgm_read(messages + _code)); | ||||
|         detail::pgm_read(messages + _code)); | ||||
|   } | ||||
| #endif | ||||
|  | ||||
| @@ -103,4 +103,4 @@ inline std::ostream& operator<<(std::ostream& s, DeserializationError::Code c) { | ||||
| } | ||||
| #endif | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -6,8 +6,9 @@ | ||||
|  | ||||
| #include <ArduinoJson/Namespace.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| namespace DeserializationOption { | ||||
| class Filter { | ||||
|  public: | ||||
|   explicit Filter(JsonVariantConst v) : _variant(v) {} | ||||
| @@ -39,7 +40,9 @@ class Filter { | ||||
|  private: | ||||
|   JsonVariantConst _variant; | ||||
| }; | ||||
| }  // namespace DeserializationOption | ||||
|  | ||||
| namespace detail { | ||||
| struct AllowAllFilter { | ||||
|   bool allow() const { | ||||
|     return true; | ||||
| @@ -62,5 +65,6 @@ struct AllowAllFilter { | ||||
|     return AllowAllFilter(); | ||||
|   } | ||||
| }; | ||||
| }  // namespace detail | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -7,8 +7,9 @@ | ||||
| #include <ArduinoJson/Namespace.hpp> | ||||
| #include <ArduinoJson/Polyfills/assert.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| namespace DeserializationOption { | ||||
| class NestingLimit { | ||||
|  public: | ||||
|   NestingLimit() : _value(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} | ||||
| @@ -26,4 +27,6 @@ class NestingLimit { | ||||
|  private: | ||||
|   uint8_t _value; | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| }  // namespace DeserializationOption | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
| #include <stdlib.h>  // for size_t | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| // The default reader is a simple wrapper for Readers that are not copiable | ||||
| template <typename TSource, typename Enable = void> | ||||
| @@ -33,7 +33,8 @@ struct BoundedReader { | ||||
|   // no default implementation because we need to pass the size to the | ||||
|   // constructor | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| #include <ArduinoJson/Deserialization/Readers/IteratorReader.hpp> | ||||
| #include <ArduinoJson/Deserialization/Readers/RamReader.hpp> | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <Arduino.h> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TSource> | ||||
| struct Reader<TSource, | ||||
| @@ -28,4 +28,4 @@ struct Reader<TSource, | ||||
|   Stream* _stream; | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <Arduino.h> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TSource> | ||||
| struct Reader<TSource, | ||||
| @@ -16,4 +16,4 @@ struct Reader<TSource, | ||||
|       : BoundedReader<const char*>(s.c_str(), s.length()) {} | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <Arduino.h> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <> | ||||
| struct Reader<const __FlashStringHelper*, void> { | ||||
| @@ -52,4 +52,5 @@ struct BoundedReader<const __FlashStringHelper*, void> { | ||||
|     return length; | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TIterator> | ||||
| class IteratorReader { | ||||
| @@ -41,4 +41,5 @@ struct Reader<TSource, typename void_<typename TSource::const_iterator>::type> | ||||
|       : IteratorReader<typename TSource::const_iterator>(source.begin(), | ||||
|                                                          source.end()) {} | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename T> | ||||
| struct IsCharOrVoid { | ||||
| @@ -48,4 +48,4 @@ struct BoundedReader<TSource*, | ||||
|                                     reinterpret_cast<const char*>(ptr) + len) {} | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <istream> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TSource> | ||||
| struct Reader<TSource, typename enable_if< | ||||
| @@ -26,4 +26,5 @@ struct Reader<TSource, typename enable_if< | ||||
|  private: | ||||
|   std::istream* _stream; | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #include <ArduinoJson/Object/MemberProxy.hpp> | ||||
| #include <ArduinoJson/Variant/JsonVariantConst.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TVariant> | ||||
| struct Reader<TVariant, typename enable_if<IsVariant<TVariant>::value>::type> | ||||
| @@ -16,4 +16,4 @@ struct Reader<TVariant, typename enable_if<IsVariant<TVariant>::value>::type> | ||||
|       : Reader<char*, void>(x.template as<const char*>()) {} | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include <ArduinoJson/Deserialization/Reader.hpp> | ||||
| #include <ArduinoJson/StringStorage/StringStorage.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <template <typename, typename> class TDeserializer, typename TReader, | ||||
|           typename TWriter> | ||||
| @@ -28,9 +28,10 @@ TDeserializer<TReader, TWriter> makeDeserializer(MemoryPool* pool, | ||||
| // deserialize(JsonDocument&, const __FlashStringHelper*, NestingLimit, Filter); | ||||
| template <template <typename, typename> class TDeserializer, typename TString, | ||||
|           typename TFilter> | ||||
| typename enable_if<!is_array<TString>::value, DeserializationError>::type | ||||
| deserialize(JsonDocument& doc, const TString& input, NestingLimit nestingLimit, | ||||
|             TFilter filter) { | ||||
| typename detail::enable_if<!is_array<TString>::value, | ||||
|                            DeserializationError>::type | ||||
| deserialize(JsonDocument& doc, const TString& input, | ||||
|             DeserializationOption::NestingLimit nestingLimit, TFilter filter) { | ||||
|   Reader<TString> reader(input); | ||||
|   VariantData* data = VariantAttorney::getData(doc); | ||||
|   MemoryPool* pool = VariantAttorney::getPool(doc); | ||||
| @@ -45,9 +46,9 @@ deserialize(JsonDocument& doc, const TString& input, NestingLimit nestingLimit, | ||||
| // deserialize(JsonDocument&, const __FlashStringHelper*, size_t, NL, Filter); | ||||
| template <template <typename, typename> class TDeserializer, typename TChar, | ||||
|           typename TFilter> | ||||
| DeserializationError deserialize(JsonDocument& doc, TChar* input, | ||||
|                                  size_t inputSize, NestingLimit nestingLimit, | ||||
|                                  TFilter filter) { | ||||
| DeserializationError deserialize( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     DeserializationOption::NestingLimit nestingLimit, TFilter filter) { | ||||
|   BoundedReader<TChar*> reader(input, inputSize); | ||||
|   VariantData* data = VariantAttorney::getData(doc); | ||||
|   MemoryPool* pool = VariantAttorney::getPool(doc); | ||||
| @@ -61,8 +62,9 @@ DeserializationError deserialize(JsonDocument& doc, TChar* input, | ||||
| // deserialize(JsonDocument&, Stream&, NestingLimit, Filter); | ||||
| template <template <typename, typename> class TDeserializer, typename TStream, | ||||
|           typename TFilter> | ||||
| DeserializationError deserialize(JsonDocument& doc, TStream& input, | ||||
|                                  NestingLimit nestingLimit, TFilter filter) { | ||||
| DeserializationError deserialize( | ||||
|     JsonDocument& doc, TStream& input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, TFilter filter) { | ||||
|   Reader<TStream> reader(input); | ||||
|   VariantData* data = VariantAttorney::getData(doc); | ||||
|   MemoryPool* pool = VariantAttorney::getPool(doc); | ||||
| @@ -72,4 +74,4 @@ DeserializationError deserialize(JsonDocument& doc, TStream& input, | ||||
|       .parse(*data, filter, nestingLimit); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Document/JsonDocument.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Helper to implement the "base-from-member" idiom | ||||
| // (we need to store the allocator before constructing JsonDocument) | ||||
| @@ -62,13 +62,14 @@ class BasicJsonDocument : AllocatorOwner<TAllocator>, public JsonDocument { | ||||
|  | ||||
|   // Construct from variant, array, or object | ||||
|   template <typename T> | ||||
|   BasicJsonDocument( | ||||
|       const T& src, | ||||
|       typename enable_if< | ||||
|           is_same<T, JsonVariant>::value || | ||||
|           is_same<T, JsonVariantConst>::value || is_same<T, JsonArray>::value || | ||||
|           is_same<T, JsonArrayConst>::value || is_same<T, JsonObject>::value || | ||||
|           is_same<T, JsonObjectConst>::value>::type* = 0) | ||||
|   BasicJsonDocument(const T& src, | ||||
|                     typename detail::enable_if< | ||||
|                         detail::is_same<T, JsonVariant>::value || | ||||
|                         detail::is_same<T, JsonVariantConst>::value || | ||||
|                         detail::is_same<T, JsonArray>::value || | ||||
|                         detail::is_same<T, JsonArrayConst>::value || | ||||
|                         detail::is_same<T, JsonObject>::value || | ||||
|                         detail::is_same<T, JsonObjectConst>::value>::type* = 0) | ||||
|       : JsonDocument(allocPool(src.memoryUsage())) { | ||||
|     set(src); | ||||
|   } | ||||
| @@ -134,17 +135,17 @@ class BasicJsonDocument : AllocatorOwner<TAllocator>, public JsonDocument { | ||||
|   using AllocatorOwner<TAllocator>::allocator; | ||||
|  | ||||
|  private: | ||||
|   MemoryPool allocPool(size_t requiredSize) { | ||||
|     size_t capa = addPadding(requiredSize); | ||||
|     return MemoryPool(reinterpret_cast<char*>(this->allocate(capa)), capa); | ||||
|   detail::MemoryPool allocPool(size_t requiredSize) { | ||||
|     size_t capa = detail::addPadding(requiredSize); | ||||
|     return {reinterpret_cast<char*>(this->allocate(capa)), capa}; | ||||
|   } | ||||
|  | ||||
|   void reallocPool(size_t requiredSize) { | ||||
|     size_t capa = addPadding(requiredSize); | ||||
|     size_t capa = detail::addPadding(requiredSize); | ||||
|     if (capa == _pool.capacity()) | ||||
|       return; | ||||
|     freePool(); | ||||
|     replacePool(allocPool(addPadding(requiredSize))); | ||||
|     replacePool(allocPool(detail::addPadding(requiredSize))); | ||||
|   } | ||||
|  | ||||
|   void freePool() { | ||||
| @@ -161,8 +162,8 @@ class BasicJsonDocument : AllocatorOwner<TAllocator>, public JsonDocument { | ||||
|     _data = src._data; | ||||
|     _pool = src._pool; | ||||
|     src._data.setNull(); | ||||
|     src._pool = MemoryPool(0, 0); | ||||
|     src._pool = {0, 0}; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
| #include <stdlib.h>  // malloc, free | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // The allocator of DynamicJsonDocument. | ||||
| struct DefaultAllocator { | ||||
| @@ -29,4 +29,4 @@ struct DefaultAllocator { | ||||
| // https://arduinojson.org/v6/api/dynamicjsondocument/ | ||||
| typedef BasicJsonDocument<DefaultAllocator> DynamicJsonDocument; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -12,12 +12,12 @@ | ||||
| #include <ArduinoJson/Variant/JsonVariantConst.hpp> | ||||
| #include <ArduinoJson/Variant/VariantTo.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // A JSON document. | ||||
| // https://arduinojson.org/v6/api/jsondocument/ | ||||
| class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|   friend class VariantAttorney; | ||||
| class JsonDocument : public detail::VariantOperators<const JsonDocument&> { | ||||
|   friend class detail::VariantAttorney; | ||||
|  | ||||
|  public: | ||||
|   // Casts the root to the specified type. | ||||
| @@ -100,15 +100,16 @@ class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|   // Replaces the root with the specified value. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/set/ | ||||
|   template <typename T> | ||||
|   typename enable_if<!is_base_of<JsonDocument, T>::value, bool>::type set( | ||||
|       const T& src) { | ||||
|   typename detail::enable_if<!detail::is_base_of<JsonDocument, T>::value, | ||||
|                              bool>::type | ||||
|   set(const T& src) { | ||||
|     return to<JsonVariant>().set(src); | ||||
|   } | ||||
|  | ||||
|   // Clears the document and converts it to the specified type. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/to/ | ||||
|   template <typename T> | ||||
|   typename VariantTo<T>::type to() { | ||||
|   typename detail::VariantTo<T>::type to() { | ||||
|     clear(); | ||||
|     return getVariant().template to<T>(); | ||||
|   } | ||||
| @@ -157,56 +158,58 @@ class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|   // https://arduinojson.org/v6/api/jsondocument/containskey/ | ||||
|   template <typename TChar> | ||||
|   bool containsKey(TChar* key) const { | ||||
|     return _data.getMember(adaptString(key)) != 0; | ||||
|     return _data.getMember(detail::adaptString(key)) != 0; | ||||
|   } | ||||
|  | ||||
|   // Returns true if the root object contains the specified key. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/containskey/ | ||||
|   template <typename TString> | ||||
|   bool containsKey(const TString& key) const { | ||||
|     return _data.getMember(adaptString(key)) != 0; | ||||
|     return _data.getMember(detail::adaptString(key)) != 0; | ||||
|   } | ||||
|  | ||||
|   // Gets or sets a root object's member. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/subscript/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE typename enable_if<IsString<TString>::value, | ||||
|                                   MemberProxy<JsonDocument&, TString> >::type | ||||
|   FORCE_INLINE typename detail::enable_if< | ||||
|       detail::IsString<TString>::value, | ||||
|       detail::MemberProxy<JsonDocument&, TString> >::type | ||||
|   operator[](const TString& key) { | ||||
|     return MemberProxy<JsonDocument&, TString>(*this, key); | ||||
|     return {*this, key}; | ||||
|   } | ||||
|  | ||||
|   // Gets or sets a root object's member. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/subscript/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE typename enable_if<IsString<TChar*>::value, | ||||
|                                   MemberProxy<JsonDocument&, TChar*> >::type | ||||
|   FORCE_INLINE typename detail::enable_if< | ||||
|       detail::IsString<TChar*>::value, | ||||
|       detail::MemberProxy<JsonDocument&, TChar*> >::type | ||||
|   operator[](TChar* key) { | ||||
|     return MemberProxy<JsonDocument&, TChar*>(*this, key); | ||||
|     return {*this, key}; | ||||
|   } | ||||
|  | ||||
|   // Gets a root object's member. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/subscript/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<IsString<TString>::value, JsonVariantConst>::type | ||||
|   FORCE_INLINE typename detail::enable_if<detail::IsString<TString>::value, | ||||
|                                           JsonVariantConst>::type | ||||
|   operator[](const TString& key) const { | ||||
|     return JsonVariantConst(_data.getMember(adaptString(key))); | ||||
|     return JsonVariantConst(_data.getMember(detail::adaptString(key))); | ||||
|   } | ||||
|  | ||||
|   // Gets a root object's member. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/subscript/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<IsString<TChar*>::value, JsonVariantConst>::type | ||||
|   FORCE_INLINE typename detail::enable_if<detail::IsString<TChar*>::value, | ||||
|                                           JsonVariantConst>::type | ||||
|   operator[](TChar* key) const { | ||||
|     return JsonVariantConst(_data.getMember(adaptString(key))); | ||||
|     return JsonVariantConst(_data.getMember(detail::adaptString(key))); | ||||
|   } | ||||
|  | ||||
|   // Gets or sets a root array's element. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/subscript/ | ||||
|   FORCE_INLINE ElementProxy<JsonDocument&> operator[](size_t index) { | ||||
|     return ElementProxy<JsonDocument&>(*this, index); | ||||
|   FORCE_INLINE detail::ElementProxy<JsonDocument&> operator[](size_t index) { | ||||
|     return {*this, index}; | ||||
|   } | ||||
|  | ||||
|   // Gets a root array's member. | ||||
| @@ -247,18 +250,19 @@ class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|   // ⚠️ Doesn't release the memory associated with the removed element. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/remove/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE typename enable_if<IsString<TChar*>::value>::type remove( | ||||
|       TChar* key) { | ||||
|     _data.remove(adaptString(key)); | ||||
|   FORCE_INLINE typename detail::enable_if<detail::IsString<TChar*>::value>::type | ||||
|   remove(TChar* key) { | ||||
|     _data.remove(detail::adaptString(key)); | ||||
|   } | ||||
|  | ||||
|   // Removes a member of the root object. | ||||
|   // ⚠️ Doesn't release the memory associated with the removed element. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/remove/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE typename enable_if<IsString<TString>::value>::type remove( | ||||
|       const TString& key) { | ||||
|     _data.remove(adaptString(key)); | ||||
|   FORCE_INLINE | ||||
|       typename detail::enable_if<detail::IsString<TString>::value>::type | ||||
|       remove(const TString& key) { | ||||
|     _data.remove(detail::adaptString(key)); | ||||
|   } | ||||
|  | ||||
|   FORCE_INLINE operator JsonVariant() { | ||||
| @@ -274,7 +278,7 @@ class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|     _data.init(); | ||||
|   } | ||||
|  | ||||
|   JsonDocument(MemoryPool pool) : _pool(pool) { | ||||
|   JsonDocument(detail::MemoryPool pool) : _pool(pool) { | ||||
|     _data.init(); | ||||
|   } | ||||
|  | ||||
| @@ -284,7 +288,7 @@ class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|  | ||||
|   ~JsonDocument() {} | ||||
|  | ||||
|   void replacePool(MemoryPool pool) { | ||||
|   void replacePool(detail::MemoryPool pool) { | ||||
|     _pool = pool; | ||||
|   } | ||||
|  | ||||
| @@ -296,27 +300,27 @@ class JsonDocument : public VariantOperators<const JsonDocument&> { | ||||
|     return JsonVariantConst(&_data); | ||||
|   } | ||||
|  | ||||
|   MemoryPool _pool; | ||||
|   VariantData _data; | ||||
|   detail::MemoryPool _pool; | ||||
|   detail::VariantData _data; | ||||
|  | ||||
|  private: | ||||
|   JsonDocument(const JsonDocument&); | ||||
|   JsonDocument& operator=(const JsonDocument&); | ||||
|  | ||||
|  protected: | ||||
|   MemoryPool* getPool() { | ||||
|   detail::MemoryPool* getPool() { | ||||
|     return &_pool; | ||||
|   } | ||||
|  | ||||
|   VariantData* getData() { | ||||
|   detail::VariantData* getData() { | ||||
|     return &_data; | ||||
|   } | ||||
|  | ||||
|   const VariantData* getData() const { | ||||
|   const detail::VariantData* getData() const { | ||||
|     return &_data; | ||||
|   } | ||||
|  | ||||
|   VariantData* getOrCreateData() { | ||||
|   detail::VariantData* getOrCreateData() { | ||||
|     return &_data; | ||||
|   } | ||||
| }; | ||||
| @@ -325,4 +329,4 @@ inline void convertToJson(const JsonDocument& src, JsonVariant dst) { | ||||
|   dst.set(src.as<JsonVariantConst>()); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -6,13 +6,13 @@ | ||||
|  | ||||
| #include <ArduinoJson/Document/JsonDocument.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // A JsonDocument with a memory pool on the stack. | ||||
| template <size_t desiredCapacity> | ||||
| class StaticJsonDocument : public JsonDocument { | ||||
|   static const size_t _capacity = | ||||
|       AddPadding<Max<1, desiredCapacity>::value>::value; | ||||
|       detail::AddPadding<detail::Max<1, desiredCapacity>::value>::value; | ||||
|  | ||||
|  public: | ||||
|   StaticJsonDocument() : JsonDocument(_buffer, _capacity) {} | ||||
| @@ -25,7 +25,8 @@ class StaticJsonDocument : public JsonDocument { | ||||
|   template <typename T> | ||||
|   StaticJsonDocument( | ||||
|       const T& src, | ||||
|       typename enable_if<is_convertible<T, JsonVariantConst>::value>::type* = 0) | ||||
|       typename detail::enable_if< | ||||
|           detail::is_convertible<T, JsonVariantConst>::value>::type* = 0) | ||||
|       : JsonDocument(_buffer, _capacity) { | ||||
|     set(src); | ||||
|   } | ||||
| @@ -57,4 +58,4 @@ class StaticJsonDocument : public JsonDocument { | ||||
|   char _buffer[_capacity]; | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Namespace.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| class EscapeSequence { | ||||
|  public: | ||||
| @@ -36,4 +36,5 @@ class EscapeSequence { | ||||
|     return &"//\"\"\\\\b\bf\fn\nr\rt\t"[excludeSolidus ? 2 : 0]; | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
| #include <ArduinoJson/Variant/VariantData.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TReader, typename TStringStorage> | ||||
| class JsonDeserializer { | ||||
| @@ -29,7 +29,7 @@ class JsonDeserializer { | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError parse(VariantData& variant, TFilter filter, | ||||
|                              NestingLimit nestingLimit) { | ||||
|                              DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     err = parseVariant(variant, filter, nestingLimit); | ||||
| @@ -59,8 +59,9 @@ class JsonDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError::Code parseVariant(VariantData& variant, TFilter filter, | ||||
|                                           NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code parseVariant( | ||||
|       VariantData& variant, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     err = skipSpacesAndComments(); | ||||
| @@ -110,7 +111,8 @@ class JsonDeserializer { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   DeserializationError::Code skipVariant(NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code skipVariant( | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     err = skipSpacesAndComments(); | ||||
| @@ -143,8 +145,9 @@ class JsonDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError::Code parseArray(CollectionData& array, TFilter filter, | ||||
|                                         NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code parseArray( | ||||
|       CollectionData& array, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     if (nestingLimit.reached()) | ||||
| @@ -196,7 +199,8 @@ class JsonDeserializer { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   DeserializationError::Code skipArray(NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code skipArray( | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     if (nestingLimit.reached()) | ||||
| @@ -227,8 +231,9 @@ class JsonDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError::Code parseObject(CollectionData& object, TFilter filter, | ||||
|                                          NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code parseObject( | ||||
|       CollectionData& object, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     if (nestingLimit.reached()) | ||||
| @@ -312,7 +317,8 @@ class JsonDeserializer { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   DeserializationError::Code skipObject(NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code skipObject( | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     if (nestingLimit.reached()) | ||||
| @@ -661,12 +667,17 @@ class JsonDeserializer { | ||||
|                      // code | ||||
| }; | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Parses a JSON input and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TString> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, const TString& input, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, | ||||
|                                        AllowAllFilter()); | ||||
| } | ||||
| @@ -675,16 +686,21 @@ DeserializationError deserializeJson( | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TString> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, const TString& input, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, const TString& input, | ||||
|     DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| // Parses a JSON input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TString> | ||||
| DeserializationError deserializeJson(JsonDocument& doc, const TString& input, | ||||
|                                      NestingLimit nestingLimit, Filter filter) { | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, const TString& input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| @@ -693,7 +709,8 @@ DeserializationError deserializeJson(JsonDocument& doc, const TString& input, | ||||
| template <typename TStream> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TStream& input, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, | ||||
|                                        AllowAllFilter()); | ||||
| } | ||||
| @@ -702,16 +719,20 @@ DeserializationError deserializeJson( | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TStream> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TStream& input, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, TStream& input, DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| // Parses a JSON input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TStream> | ||||
| DeserializationError deserializeJson(JsonDocument& doc, TStream& input, | ||||
|                                      NestingLimit nestingLimit, Filter filter) { | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TStream& input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| @@ -720,7 +741,8 @@ DeserializationError deserializeJson(JsonDocument& doc, TStream& input, | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TChar* input, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, | ||||
|                                        AllowAllFilter()); | ||||
| } | ||||
| @@ -729,16 +751,20 @@ DeserializationError deserializeJson( | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TChar* input, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, TChar* input, DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| // Parses a JSON input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeJson(JsonDocument& doc, TChar* input, | ||||
|                                      NestingLimit nestingLimit, Filter filter) { | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TChar* input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| @@ -747,7 +773,8 @@ DeserializationError deserializeJson(JsonDocument& doc, TChar* input, | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, inputSize, nestingLimit, | ||||
|                                        AllowAllFilter()); | ||||
| } | ||||
| @@ -756,8 +783,11 @@ DeserializationError deserializeJson( | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = | ||||
|         DeserializationOption::NestingLimit()) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, inputSize, nestingLimit, | ||||
|                                        filter); | ||||
| } | ||||
| @@ -765,11 +795,13 @@ DeserializationError deserializeJson( | ||||
| // Parses a JSON input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/json/deserializejson/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeJson(JsonDocument& doc, TChar* input, | ||||
|                                      size_t inputSize, | ||||
|                                      NestingLimit nestingLimit, Filter filter) { | ||||
| DeserializationError deserializeJson( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<JsonDeserializer>(doc, input, inputSize, nestingLimit, | ||||
|                                        filter); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <ArduinoJson/Serialization/serialize.hpp> | ||||
| #include <ArduinoJson/Variant/Visitor.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TWriter> | ||||
| class JsonSerializer : public Visitor<size_t> { | ||||
| @@ -115,10 +115,15 @@ class JsonSerializer : public Visitor<size_t> { | ||||
|   TextFormatter<TWriter> _formatter; | ||||
| }; | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Produces a minified JSON document. | ||||
| // https://arduinojson.org/v6/api/json/serializejson/ | ||||
| template <typename TDestination> | ||||
| size_t serializeJson(JsonVariantConst source, TDestination& destination) { | ||||
|   using namespace detail; | ||||
|   return serialize<JsonSerializer>(source, destination); | ||||
| } | ||||
|  | ||||
| @@ -126,23 +131,25 @@ size_t serializeJson(JsonVariantConst source, TDestination& destination) { | ||||
| // https://arduinojson.org/v6/api/json/serializejson/ | ||||
| inline size_t serializeJson(JsonVariantConst source, void* buffer, | ||||
|                             size_t bufferSize) { | ||||
|   using namespace detail; | ||||
|   return serialize<JsonSerializer>(source, buffer, bufferSize); | ||||
| } | ||||
|  | ||||
| // Computes the length of the document that serializeJson() produces. | ||||
| // https://arduinojson.org/v6/api/json/measurejson/ | ||||
| inline size_t measureJson(JsonVariantConst source) { | ||||
|   using namespace detail; | ||||
|   return measure<JsonSerializer>(source); | ||||
| } | ||||
|  | ||||
| #if ARDUINOJSON_ENABLE_STD_STREAM | ||||
| template <typename T> | ||||
| inline typename enable_if<is_convertible<T, JsonVariantConst>::value, | ||||
|                           std::ostream&>::type | ||||
| inline typename detail::enable_if< | ||||
|     detail::is_convertible<T, JsonVariantConst>::value, std::ostream&>::type | ||||
| operator<<(std::ostream& os, const T& source) { | ||||
|   serializeJson(source, os); | ||||
|   return os; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Polyfills/assert.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TReader> | ||||
| class Latch { | ||||
| @@ -53,4 +53,4 @@ class Latch { | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <ArduinoJson/Serialization/measure.hpp> | ||||
| #include <ArduinoJson/Serialization/serialize.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TWriter> | ||||
| class PrettyJsonSerializer : public JsonSerializer<TWriter> { | ||||
| @@ -71,10 +71,15 @@ class PrettyJsonSerializer : public JsonSerializer<TWriter> { | ||||
|   uint8_t _nesting; | ||||
| }; | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Produces JsonDocument to create a prettified JSON document. | ||||
| // https://arduinojson.org/v6/api/json/serializejsonpretty/ | ||||
| template <typename TDestination> | ||||
| size_t serializeJsonPretty(JsonVariantConst source, TDestination& destination) { | ||||
|   using namespace ArduinoJson::detail; | ||||
|   return serialize<PrettyJsonSerializer>(source, destination); | ||||
| } | ||||
|  | ||||
| @@ -82,13 +87,15 @@ size_t serializeJsonPretty(JsonVariantConst source, TDestination& destination) { | ||||
| // https://arduinojson.org/v6/api/json/serializejsonpretty/ | ||||
| inline size_t serializeJsonPretty(JsonVariantConst source, void* buffer, | ||||
|                                   size_t bufferSize) { | ||||
|   using namespace ArduinoJson::detail; | ||||
|   return serialize<PrettyJsonSerializer>(source, buffer, bufferSize); | ||||
| } | ||||
|  | ||||
| // Computes the length of the document that serializeJsonPretty() produces. | ||||
| // https://arduinojson.org/v6/api/json/measurejsonpretty/ | ||||
| inline size_t measureJsonPretty(JsonVariantConst source) { | ||||
|   using namespace ArduinoJson::detail; | ||||
|   return measure<PrettyJsonSerializer>(source); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
| #include <ArduinoJson/Serialization/CountingDecorator.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TWriter> | ||||
| class TextFormatter { | ||||
| @@ -170,4 +170,5 @@ class TextFormatter { | ||||
|  private: | ||||
|   TextFormatter& operator=(const TextFormatter&);  // cannot be assigned | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| namespace Utf16 { | ||||
| inline bool isHighSurrogate(uint16_t codeunit) { | ||||
| @@ -58,7 +58,7 @@ class Codepoint { | ||||
|   uint32_t _codepoint; | ||||
| }; | ||||
| }  // namespace Utf16 | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| #if defined(__GNUC__) | ||||
| #  if __GNUC__ >= 8 | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Namespace.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| namespace Utf8 { | ||||
| template <typename TStringBuilder> | ||||
| @@ -43,4 +43,4 @@ inline void encodeCodepoint(uint32_t codepoint32, TStringBuilder& str) { | ||||
|   } | ||||
| } | ||||
| }  // namespace Utf8 | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
| #include <stddef.h>  // size_t | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| #if ARDUINOJSON_ENABLE_ALIGNMENT | ||||
|  | ||||
| @@ -57,4 +57,4 @@ inline T* addPadding(T* p) { | ||||
|   return reinterpret_cast<T*>(address); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -17,14 +17,14 @@ | ||||
| // Computes the size required to store an array in a JsonDocument. | ||||
| // https://arduinojson.org/v6/how-to/determine-the-capacity-of-the-jsondocument/ | ||||
| #define JSON_ARRAY_SIZE(NUMBER_OF_ELEMENTS) \ | ||||
|   ((NUMBER_OF_ELEMENTS) * sizeof(ARDUINOJSON_NAMESPACE::VariantSlot)) | ||||
|   ((NUMBER_OF_ELEMENTS) * sizeof(ArduinoJson::detail::VariantSlot)) | ||||
|  | ||||
| // Returns the size (in bytes) of an object with n elements. | ||||
| // Can be very handy to determine the size of a StaticMemoryPool. | ||||
| #define JSON_OBJECT_SIZE(NUMBER_OF_ELEMENTS) \ | ||||
|   ((NUMBER_OF_ELEMENTS) * sizeof(ARDUINOJSON_NAMESPACE::VariantSlot)) | ||||
|   ((NUMBER_OF_ELEMENTS) * sizeof(ArduinoJson::detail::VariantSlot)) | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| // _begin                                   _end | ||||
| // v                                           v | ||||
| @@ -250,4 +250,4 @@ bool storeString(MemoryPool* pool, TAdaptedString str, TCallback callback) { | ||||
|   return storeString(pool, str, str.storagePolicy(), callback); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Strings/StringAdapters.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // A special type of data that can be used to insert pregenerated JSON portions. | ||||
| template <typename T> | ||||
| @@ -58,11 +58,12 @@ inline SerializedValue<T> serialized(T str) { | ||||
|  | ||||
| template <typename TChar> | ||||
| inline SerializedValue<TChar*> serialized(TChar* p) { | ||||
|   return SerializedValue<TChar*>(p, adaptString(p).size()); | ||||
|   return SerializedValue<TChar*>(p, detail::adaptString(p).size()); | ||||
| } | ||||
|  | ||||
| template <typename TChar> | ||||
| inline SerializedValue<TChar*> serialized(TChar* p, size_t n) { | ||||
|   return SerializedValue<TChar*>(p, n); | ||||
| } | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
| #include <ArduinoJson/Variant/VariantData.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TReader, typename TStringStorage> | ||||
| class MsgPackDeserializer { | ||||
| @@ -25,7 +25,7 @@ class MsgPackDeserializer { | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError parse(VariantData& variant, TFilter filter, | ||||
|                              NestingLimit nestingLimit) { | ||||
|                              DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|     err = parseVariant(&variant, filter, nestingLimit); | ||||
|     return _foundSomething ? err : DeserializationError::EmptyInput; | ||||
| @@ -33,8 +33,9 @@ class MsgPackDeserializer { | ||||
|  | ||||
|  private: | ||||
|   template <typename TFilter> | ||||
|   DeserializationError::Code parseVariant(VariantData* variant, TFilter filter, | ||||
|                                           NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code parseVariant( | ||||
|       VariantData* variant, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     uint8_t code = 0;  // TODO: why do we need to initialize this variable? | ||||
| @@ -395,8 +396,9 @@ class MsgPackDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TSize, typename TFilter> | ||||
|   DeserializationError::Code readArray(VariantData* variant, TFilter filter, | ||||
|                                        NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code readArray( | ||||
|       VariantData* variant, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|     TSize size; | ||||
|  | ||||
| @@ -408,9 +410,9 @@ class MsgPackDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError::Code readArray(VariantData* variant, size_t n, | ||||
|                                        TFilter filter, | ||||
|                                        NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code readArray( | ||||
|       VariantData* variant, size_t n, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     if (nestingLimit.reached()) | ||||
| @@ -449,8 +451,9 @@ class MsgPackDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TSize, typename TFilter> | ||||
|   DeserializationError::Code readObject(VariantData* variant, TFilter filter, | ||||
|                                         NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code readObject( | ||||
|       VariantData* variant, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|     TSize size; | ||||
|  | ||||
| @@ -462,9 +465,9 @@ class MsgPackDeserializer { | ||||
|   } | ||||
|  | ||||
|   template <typename TFilter> | ||||
|   DeserializationError::Code readObject(VariantData* variant, size_t n, | ||||
|                                         TFilter filter, | ||||
|                                         NestingLimit nestingLimit) { | ||||
|   DeserializationError::Code readObject( | ||||
|       VariantData* variant, size_t n, TFilter filter, | ||||
|       DeserializationOption::NestingLimit nestingLimit) { | ||||
|     DeserializationError::Code err; | ||||
|  | ||||
|     if (nestingLimit.reached()) | ||||
| @@ -557,12 +560,17 @@ class MsgPackDeserializer { | ||||
|   bool _foundSomething; | ||||
| }; | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Parses a MessagePack input and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TString> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, const TString& input, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, | ||||
|                                           AllowAllFilter()); | ||||
| } | ||||
| @@ -571,17 +579,21 @@ DeserializationError deserializeMsgPack( | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TString> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, const TString& input, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, const TString& input, | ||||
|     DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| // Parses a MessagePack input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TString> | ||||
| DeserializationError deserializeMsgPack(JsonDocument& doc, const TString& input, | ||||
|                                         NestingLimit nestingLimit, | ||||
|                                         Filter filter) { | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, const TString& input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| @@ -590,7 +602,8 @@ DeserializationError deserializeMsgPack(JsonDocument& doc, const TString& input, | ||||
| template <typename TStream> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TStream& input, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, | ||||
|                                           AllowAllFilter()); | ||||
| } | ||||
| @@ -599,17 +612,20 @@ DeserializationError deserializeMsgPack( | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TStream> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TStream& input, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, TStream& input, DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| // Parses a MessagePack input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TStream> | ||||
| DeserializationError deserializeMsgPack(JsonDocument& doc, TStream& input, | ||||
|                                         NestingLimit nestingLimit, | ||||
|                                         Filter filter) { | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TStream& input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| @@ -618,7 +634,8 @@ DeserializationError deserializeMsgPack(JsonDocument& doc, TStream& input, | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TChar* input, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, | ||||
|                                           AllowAllFilter()); | ||||
| } | ||||
| @@ -627,17 +644,20 @@ DeserializationError deserializeMsgPack( | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TChar* input, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, TChar* input, DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| // Parses a MessagePack input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeMsgPack(JsonDocument& doc, TChar* input, | ||||
|                                         NestingLimit nestingLimit, | ||||
|                                         Filter filter) { | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TChar* input, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, nestingLimit, filter); | ||||
| } | ||||
|  | ||||
| @@ -646,7 +666,8 @@ DeserializationError deserializeMsgPack(JsonDocument& doc, TChar* input, | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, inputSize, nestingLimit, | ||||
|                                           AllowAllFilter()); | ||||
| } | ||||
| @@ -655,8 +676,10 @@ DeserializationError deserializeMsgPack( | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, Filter filter, | ||||
|     NestingLimit nestingLimit = NestingLimit()) { | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     DeserializationOption::Filter filter, | ||||
|     DeserializationOption::NestingLimit nestingLimit = {}) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, inputSize, nestingLimit, | ||||
|                                           filter); | ||||
| } | ||||
| @@ -664,12 +687,13 @@ DeserializationError deserializeMsgPack( | ||||
| // Parses a MessagePack input, filters, and puts the result in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/msgpack/deserializemsgpack/ | ||||
| template <typename TChar> | ||||
| DeserializationError deserializeMsgPack(JsonDocument& doc, TChar* input, | ||||
|                                         size_t inputSize, | ||||
|                                         NestingLimit nestingLimit, | ||||
|                                         Filter filter) { | ||||
| DeserializationError deserializeMsgPack( | ||||
|     JsonDocument& doc, TChar* input, size_t inputSize, | ||||
|     DeserializationOption::NestingLimit nestingLimit, | ||||
|     DeserializationOption::Filter filter) { | ||||
|   using namespace detail; | ||||
|   return deserialize<MsgPackDeserializer>(doc, input, inputSize, nestingLimit, | ||||
|                                           filter); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
| #include <ArduinoJson/Serialization/serialize.hpp> | ||||
| #include <ArduinoJson/Variant/VariantData.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TWriter> | ||||
| class MsgPackSerializer : public Visitor<size_t> { | ||||
| @@ -197,10 +197,15 @@ class MsgPackSerializer : public Visitor<size_t> { | ||||
|   CountingDecorator<TWriter> _writer; | ||||
| }; | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // Produces a MessagePack document. | ||||
| // https://arduinojson.org/v6/api/msgpack/serializemsgpack/ | ||||
| template <typename TDestination> | ||||
| inline size_t serializeMsgPack(JsonVariantConst source, TDestination& output) { | ||||
|   using namespace ArduinoJson::detail; | ||||
|   return serialize<MsgPackSerializer>(source, output); | ||||
| } | ||||
|  | ||||
| @@ -208,13 +213,15 @@ inline size_t serializeMsgPack(JsonVariantConst source, TDestination& output) { | ||||
| // https://arduinojson.org/v6/api/msgpack/serializemsgpack/ | ||||
| inline size_t serializeMsgPack(JsonVariantConst source, void* output, | ||||
|                                size_t size) { | ||||
|   using namespace ArduinoJson::detail; | ||||
|   return serialize<MsgPackSerializer>(source, output, size); | ||||
| } | ||||
|  | ||||
| // Computes the length of the document that serializeMsgPack() produces. | ||||
| // https://arduinojson.org/v6/api/msgpack/measuremsgpack/ | ||||
| inline size_t measureMsgPack(JsonVariantConst source) { | ||||
|   using namespace ArduinoJson::detail; | ||||
|   return measure<MsgPackSerializer>(source); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| #if ARDUINOJSON_LITTLE_ENDIAN | ||||
| inline void swapBytes(uint8_t& a, uint8_t& b) { | ||||
| @@ -43,4 +43,4 @@ template <typename T> | ||||
| inline void fixEndianess(T&) {} | ||||
| #endif | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Namespace.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| inline void doubleToFloat(const uint8_t d[8], uint8_t f[4]) { | ||||
|   f[0] = uint8_t((d[0] & 0xC0) | (d[0] << 3 & 0x3f) | (d[1] >> 5)); | ||||
| @@ -15,4 +15,4 @@ inline void doubleToFloat(const uint8_t d[8], uint8_t f[4]) { | ||||
|   f[3] = uint8_t((d[3] << 3) | (d[4] >> 5)); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -8,11 +8,11 @@ | ||||
| #include <ArduinoJson/Polyfills/preprocessor.hpp> | ||||
| #include <ArduinoJson/version.hpp> | ||||
|  | ||||
| #ifndef ARDUINOJSON_NAMESPACE | ||||
| #ifndef ARDUINOJSON_VERSION_NAMESPACE | ||||
|  | ||||
| #  define ARDUINOJSON_NAMESPACE                                               \ | ||||
| #  define ARDUINOJSON_VERSION_NAMESPACE                                       \ | ||||
|     ARDUINOJSON_CONCAT4(                                                      \ | ||||
|         ARDUINOJSON_CONCAT4(ArduinoJson, ARDUINOJSON_VERSION_MAJOR,           \ | ||||
|         ARDUINOJSON_CONCAT4(V, ARDUINOJSON_VERSION_MAJOR,                     \ | ||||
|                             ARDUINOJSON_VERSION_MINOR,                        \ | ||||
|                             ARDUINOJSON_VERSION_REVISION),                    \ | ||||
|         _,                                                                    \ | ||||
| @@ -24,3 +24,21 @@ | ||||
|             ARDUINOJSON_ENABLE_COMMENTS, ARDUINOJSON_DECODE_UNICODE)) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #define ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE \ | ||||
|   namespace ArduinoJson {                  \ | ||||
|   inline namespace ARDUINOJSON_VERSION_NAMESPACE { | ||||
|  | ||||
| #define ARDUINOJSON_END_PUBLIC_NAMESPACE \ | ||||
|   }                                      \ | ||||
|   } | ||||
|  | ||||
| #define ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE        \ | ||||
|   namespace ArduinoJson {                          \ | ||||
|   inline namespace ARDUINOJSON_VERSION_NAMESPACE { \ | ||||
|   namespace detail { | ||||
|  | ||||
| #define ARDUINOJSON_END_PRIVATE_NAMESPACE \ | ||||
|   }                                       \ | ||||
|   }                                       \ | ||||
|   } | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
| #include <ArduinoJson/Numbers/FloatTraits.hpp> | ||||
| #include <ArduinoJson/Polyfills/math.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TFloat> | ||||
| struct FloatParts { | ||||
| @@ -84,4 +84,5 @@ struct FloatParts { | ||||
|     return powersOf10; | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -14,7 +14,7 @@ | ||||
| #include <ArduinoJson/Polyfills/preprocessor.hpp> | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename T, size_t = sizeof(T)> | ||||
| struct FloatTraits {}; | ||||
| @@ -262,4 +262,5 @@ struct FloatTraits<T, 4 /*32bits*/> { | ||||
|     return forge(0xFf7fffff); | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -7,11 +7,12 @@ | ||||
| #include <ArduinoJson/Configuration.hpp> | ||||
| #include <ArduinoJson/Namespace.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| #if ARDUINOJSON_USE_DOUBLE | ||||
| typedef double JsonFloat; | ||||
| #else | ||||
| typedef float JsonFloat; | ||||
| #endif | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| #include <stdint.h>  // int64_t | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| #if ARDUINOJSON_USE_LONG_LONG | ||||
| typedef int64_t JsonInteger; | ||||
| @@ -19,10 +19,10 @@ typedef long JsonInteger; | ||||
| typedef unsigned long JsonUInt; | ||||
| #endif | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|  | ||||
| #define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T)                  \ | ||||
|   static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::JsonInteger), \ | ||||
|   static_assert(sizeof(T) <= sizeof(ArduinoJson::JsonInteger),           \ | ||||
|                 "To use 64-bit integers with ArduinoJson, you must set " \ | ||||
|                 "ARDUINOJSON_USE_LONG_LONG to 1. See "                   \ | ||||
|                 "https://arduinojson.org/v6/api/config/use_long_long/"); | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #include <ArduinoJson/Numbers/JsonInteger.hpp> | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| enum CompareResult { | ||||
|   COMPARE_RESULT_DIFFER = 0, | ||||
| @@ -117,4 +117,4 @@ CompareResult arithmeticCompareNegateRight( | ||||
|   return arithmeticCompare(static_cast<T1>(rhs), -lhs); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| #include <ArduinoJson/Polyfills/limits.hpp> | ||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| // uint32 -> int32 | ||||
| // uint64 -> int32 | ||||
| @@ -126,7 +126,7 @@ template <typename TOut, typename TIn> | ||||
| TOut convertNumber(TIn value) { | ||||
|   return canConvertNumber<TOut>(value) ? TOut(value) : 0; | ||||
| } | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|  | ||||
| #if defined(__clang__) | ||||
| #  pragma clang diagnostic pop | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
| #include <ArduinoJson/Variant/Converter.hpp> | ||||
| #include <ArduinoJson/Variant/VariantData.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename A, typename B> | ||||
| struct choose_largest : conditional<(sizeof(A) > sizeof(B)), A, B> {}; | ||||
| @@ -150,4 +150,4 @@ inline T parseNumber(const char* s) { | ||||
|   parseNumber(s, value); | ||||
|   return Converter<T>::fromJson(JsonVariantConst(&value)); | ||||
| } | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -7,14 +7,14 @@ | ||||
| #include <ArduinoJson/Object/JsonObjectConst.hpp> | ||||
| #include <ArduinoJson/Object/MemberProxy.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| class JsonArray; | ||||
|  | ||||
| // A reference to an object in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/jsonobject/ | ||||
| class JsonObject : public VariantOperators<JsonObject> { | ||||
|   friend class VariantAttorney; | ||||
| class JsonObject : public detail::VariantOperators<JsonObject> { | ||||
|   friend class detail::VariantAttorney; | ||||
|  | ||||
|  public: | ||||
|   typedef JsonObjectIterator iterator; | ||||
| @@ -23,12 +23,12 @@ class JsonObject : public VariantOperators<JsonObject> { | ||||
|   FORCE_INLINE JsonObject() : _data(0), _pool(0) {} | ||||
|  | ||||
|   // INTERNAL USE ONLY | ||||
|   FORCE_INLINE JsonObject(MemoryPool* buf, CollectionData* data) | ||||
|   FORCE_INLINE JsonObject(detail::MemoryPool* buf, detail::CollectionData* data) | ||||
|       : _data(data), _pool(buf) {} | ||||
|  | ||||
|   operator JsonVariant() const { | ||||
|     void* data = _data;  // prevent warning cast-align | ||||
|     return JsonVariant(_pool, reinterpret_cast<VariantData*>(data)); | ||||
|     return JsonVariant(_pool, reinterpret_cast<detail::VariantData*>(data)); | ||||
|   } | ||||
|  | ||||
|   operator JsonObjectConst() const { | ||||
| @@ -108,19 +108,21 @@ class JsonObject : public VariantOperators<JsonObject> { | ||||
|   // Gets or sets the member with specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobject/subscript/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE typename enable_if<IsString<TString>::value, | ||||
|                                   MemberProxy<JsonObject, TString> >::type | ||||
|   FORCE_INLINE typename detail::enable_if< | ||||
|       detail::IsString<TString>::value, | ||||
|       detail::MemberProxy<JsonObject, TString> >::type | ||||
|   operator[](const TString& key) const { | ||||
|     return MemberProxy<JsonObject, TString>(*this, key); | ||||
|     return {*this, key}; | ||||
|   } | ||||
|  | ||||
|   // Gets or sets the member with specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobject/subscript/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE typename enable_if<IsString<TChar*>::value, | ||||
|                                   MemberProxy<JsonObject, TChar*> >::type | ||||
|   FORCE_INLINE | ||||
|       typename detail::enable_if<detail::IsString<TChar*>::value, | ||||
|                                  detail::MemberProxy<JsonObject, TChar*> >::type | ||||
|       operator[](TChar* key) const { | ||||
|     return MemberProxy<JsonObject, TChar*>(*this, key); | ||||
|     return {*this, key}; | ||||
|   } | ||||
|  | ||||
|   // Removes the member at the specified iterator. | ||||
| @@ -137,7 +139,7 @@ class JsonObject : public VariantOperators<JsonObject> { | ||||
|   // https://arduinojson.org/v6/api/jsonobject/remove/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE void remove(const TString& key) const { | ||||
|     removeMember(adaptString(key)); | ||||
|     removeMember(detail::adaptString(key)); | ||||
|   } | ||||
|  | ||||
|   // Removes the member with the specified key. | ||||
| @@ -145,23 +147,25 @@ class JsonObject : public VariantOperators<JsonObject> { | ||||
|   // https://arduinojson.org/v6/api/jsonobject/remove/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE void remove(TChar* key) const { | ||||
|     removeMember(adaptString(key)); | ||||
|     removeMember(detail::adaptString(key)); | ||||
|   } | ||||
|  | ||||
|   // Returns true if the object contains the specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobject/containskey/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE typename enable_if<IsString<TString>::value, bool>::type | ||||
|   FORCE_INLINE | ||||
|       typename detail::enable_if<detail::IsString<TString>::value, bool>::type | ||||
|       containsKey(const TString& key) const { | ||||
|     return getMember(adaptString(key)) != 0; | ||||
|     return getMember(detail::adaptString(key)) != 0; | ||||
|   } | ||||
|  | ||||
|   // Returns true if the object contains the specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobject/containskey/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE typename enable_if<IsString<TChar*>::value, bool>::type | ||||
|   FORCE_INLINE | ||||
|       typename detail::enable_if<detail::IsString<TChar*>::value, bool>::type | ||||
|       containsKey(TChar* key) const { | ||||
|     return getMember(adaptString(key)) != 0; | ||||
|     return getMember(detail::adaptString(key)) != 0; | ||||
|   } | ||||
|  | ||||
|   // Creates an array and adds it to the object. | ||||
| @@ -189,20 +193,20 @@ class JsonObject : public VariantOperators<JsonObject> { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   MemoryPool* getPool() const { | ||||
|   detail::MemoryPool* getPool() const { | ||||
|     return _pool; | ||||
|   } | ||||
|  | ||||
|   VariantData* getData() const { | ||||
|     return collectionToVariant(_data); | ||||
|   detail::VariantData* getData() const { | ||||
|     return detail::collectionToVariant(_data); | ||||
|   } | ||||
|  | ||||
|   VariantData* getOrCreateData() const { | ||||
|     return collectionToVariant(_data); | ||||
|   detail::VariantData* getOrCreateData() const { | ||||
|     return detail::collectionToVariant(_data); | ||||
|   } | ||||
|  | ||||
|   template <typename TAdaptedString> | ||||
|   inline VariantData* getMember(TAdaptedString key) const { | ||||
|   inline detail::VariantData* getMember(TAdaptedString key) const { | ||||
|     if (!_data) | ||||
|       return 0; | ||||
|     return _data->getMember(key); | ||||
| @@ -215,23 +219,23 @@ class JsonObject : public VariantOperators<JsonObject> { | ||||
|     _data->removeMember(key); | ||||
|   } | ||||
|  | ||||
|   CollectionData* _data; | ||||
|   MemoryPool* _pool; | ||||
|   detail::CollectionData* _data; | ||||
|   detail::MemoryPool* _pool; | ||||
| }; | ||||
|  | ||||
| template <> | ||||
| struct Converter<JsonObject> : private VariantAttorney { | ||||
| struct Converter<JsonObject> : private detail::VariantAttorney { | ||||
|   static void toJson(JsonVariantConst src, JsonVariant dst) { | ||||
|     variantCopyFrom(getData(dst), getData(src), getPool(dst)); | ||||
|   } | ||||
|  | ||||
|   static JsonObject fromJson(JsonVariant src) { | ||||
|     VariantData* data = getData(src); | ||||
|     MemoryPool* pool = getPool(src); | ||||
|     auto data = getData(src); | ||||
|     auto pool = getPool(src); | ||||
|     return JsonObject(pool, data != 0 ? data->asObject() : 0); | ||||
|   } | ||||
|  | ||||
|   static InvalidConversion<JsonVariantConst, JsonObject> fromJson( | ||||
|   static detail::InvalidConversion<JsonVariantConst, JsonObject> fromJson( | ||||
|       JsonVariantConst); | ||||
|  | ||||
|   static bool checkJson(JsonVariantConst) { | ||||
| @@ -239,8 +243,9 @@ struct Converter<JsonObject> : private VariantAttorney { | ||||
|   } | ||||
|  | ||||
|   static bool checkJson(JsonVariant src) { | ||||
|     VariantData* data = getData(src); | ||||
|     auto data = getData(src); | ||||
|     return data && data->isObject(); | ||||
|   } | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -7,13 +7,13 @@ | ||||
| #include <ArduinoJson/Object/JsonObjectIterator.hpp> | ||||
| #include <ArduinoJson/Variant/VariantOperators.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // A read-only reference to an object in a JsonDocument. | ||||
| // https://arduinojson.org/v6/api/jsonobjectconst/ | ||||
| class JsonObjectConst : public VariantOperators<JsonObjectConst> { | ||||
| class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> { | ||||
|   friend class JsonObject; | ||||
|   friend class VariantAttorney; | ||||
|   friend class detail::VariantAttorney; | ||||
|  | ||||
|  public: | ||||
|   typedef JsonObjectConstIterator iterator; | ||||
| @@ -22,7 +22,7 @@ class JsonObjectConst : public VariantOperators<JsonObjectConst> { | ||||
|   JsonObjectConst() : _data(0) {} | ||||
|  | ||||
|   // INTERNAL USE ONLY | ||||
|   JsonObjectConst(const CollectionData* data) : _data(data) {} | ||||
|   JsonObjectConst(const detail::CollectionData* data) : _data(data) {} | ||||
|  | ||||
|   operator JsonVariantConst() const { | ||||
|     return JsonVariantConst(collectionToVariant(_data)); | ||||
| @@ -76,32 +76,32 @@ class JsonObjectConst : public VariantOperators<JsonObjectConst> { | ||||
|   // https://arduinojson.org/v6/api/jsonobjectconst/containskey/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE bool containsKey(const TString& key) const { | ||||
|     return getMember(adaptString(key)) != 0; | ||||
|     return getMember(detail::adaptString(key)) != 0; | ||||
|   } | ||||
|  | ||||
|   // Returns true if the object contains the specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobjectconst/containskey/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE bool containsKey(TChar* key) const { | ||||
|     return getMember(adaptString(key)) != 0; | ||||
|     return getMember(detail::adaptString(key)) != 0; | ||||
|   } | ||||
|  | ||||
|   // Gets the member with specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobjectconst/subscript/ | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<IsString<TString>::value, JsonVariantConst>::type | ||||
|   FORCE_INLINE typename detail::enable_if<detail::IsString<TString>::value, | ||||
|                                           JsonVariantConst>::type | ||||
|   operator[](const TString& key) const { | ||||
|     return JsonVariantConst(getMember(adaptString(key))); | ||||
|     return JsonVariantConst(getMember(detail::adaptString(key))); | ||||
|   } | ||||
|  | ||||
|   // Gets the member with specified key. | ||||
|   // https://arduinojson.org/v6/api/jsonobjectconst/subscript/ | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<IsString<TChar*>::value, JsonVariantConst>::type | ||||
|   FORCE_INLINE typename detail::enable_if<detail::IsString<TChar*>::value, | ||||
|                                           JsonVariantConst>::type | ||||
|   operator[](TChar* key) const { | ||||
|     return JsonVariantConst(getMember(adaptString(key))); | ||||
|     return JsonVariantConst(getMember(detail::adaptString(key))); | ||||
|   } | ||||
|  | ||||
|   // Compares objects. | ||||
| @@ -122,35 +122,35 @@ class JsonObjectConst : public VariantOperators<JsonObjectConst> { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   const VariantData* getData() const { | ||||
|   const detail::VariantData* getData() const { | ||||
|     return collectionToVariant(_data); | ||||
|   } | ||||
|  | ||||
|   template <typename TAdaptedString> | ||||
|   const VariantData* getMember(TAdaptedString key) const { | ||||
|   const detail::VariantData* getMember(TAdaptedString key) const { | ||||
|     if (!_data) | ||||
|       return 0; | ||||
|     return _data->getMember(key); | ||||
|   } | ||||
|  | ||||
|   const CollectionData* _data; | ||||
|   const detail::CollectionData* _data; | ||||
| }; | ||||
|  | ||||
| template <> | ||||
| struct Converter<JsonObjectConst> : private VariantAttorney { | ||||
| struct Converter<JsonObjectConst> : private detail::VariantAttorney { | ||||
|   static void toJson(JsonVariantConst src, JsonVariant dst) { | ||||
|     variantCopyFrom(getData(dst), getData(src), getPool(dst)); | ||||
|   } | ||||
|  | ||||
|   static JsonObjectConst fromJson(JsonVariantConst src) { | ||||
|     const VariantData* data = getData(src); | ||||
|     auto data = getData(src); | ||||
|     return data != 0 ? data->asObject() : 0; | ||||
|   } | ||||
|  | ||||
|   static bool checkJson(JsonVariantConst src) { | ||||
|     const VariantData* data = getData(src); | ||||
|     auto data = getData(src); | ||||
|     return data && data->isObject(); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #include <ArduinoJson/Array/JsonArray.hpp> | ||||
| #include <ArduinoJson/Object/JsonObject.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| template <typename TString> | ||||
| inline JsonArray JsonObject::createNestedArray(const TString& key) const { | ||||
| @@ -19,6 +19,10 @@ inline JsonArray JsonObject::createNestedArray(TChar* key) const { | ||||
|   return operator[](key).template to<JsonArray>(); | ||||
| } | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename TDerived> | ||||
| template <typename TString> | ||||
| inline JsonArray VariantRefBase<TDerived>::createNestedArray( | ||||
| @@ -78,4 +82,4 @@ VariantRefBase<TDerived>::operator[](const TString& key) const { | ||||
|   return MemberProxy<TDerived, TString>(derived(), key); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -7,11 +7,12 @@ | ||||
| #include <ArduinoJson/Object/JsonPair.hpp> | ||||
| #include <ArduinoJson/Variant/SlotFunctions.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| class JsonPairPtr { | ||||
|  public: | ||||
|   JsonPairPtr(MemoryPool* pool, VariantSlot* slot) : _pair(pool, slot) {} | ||||
|   JsonPairPtr(detail::MemoryPool* pool, detail::VariantSlot* slot) | ||||
|       : _pair(pool, slot) {} | ||||
|  | ||||
|   const JsonPair* operator->() const { | ||||
|     return &_pair; | ||||
| @@ -31,7 +32,8 @@ class JsonObjectIterator { | ||||
|  public: | ||||
|   JsonObjectIterator() : _slot(0) {} | ||||
|  | ||||
|   explicit JsonObjectIterator(MemoryPool* pool, VariantSlot* slot) | ||||
|   explicit JsonObjectIterator(detail::MemoryPool* pool, | ||||
|                               detail::VariantSlot* slot) | ||||
|       : _pool(pool), _slot(slot) {} | ||||
|  | ||||
|   JsonPair operator*() const { | ||||
| @@ -60,13 +62,13 @@ class JsonObjectIterator { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   MemoryPool* _pool; | ||||
|   VariantSlot* _slot; | ||||
|   detail::MemoryPool* _pool; | ||||
|   detail::VariantSlot* _slot; | ||||
| }; | ||||
|  | ||||
| class JsonPairConstPtr { | ||||
|  public: | ||||
|   JsonPairConstPtr(const VariantSlot* slot) : _pair(slot) {} | ||||
|   JsonPairConstPtr(const detail::VariantSlot* slot) : _pair(slot) {} | ||||
|  | ||||
|   const JsonPairConst* operator->() const { | ||||
|     return &_pair; | ||||
| @@ -86,7 +88,8 @@ class JsonObjectConstIterator { | ||||
|  public: | ||||
|   JsonObjectConstIterator() : _slot(0) {} | ||||
|  | ||||
|   explicit JsonObjectConstIterator(const VariantSlot* slot) : _slot(slot) {} | ||||
|   explicit JsonObjectConstIterator(const detail::VariantSlot* slot) | ||||
|       : _slot(slot) {} | ||||
|  | ||||
|   JsonPairConst operator*() const { | ||||
|     return JsonPairConst(_slot); | ||||
| @@ -114,6 +117,7 @@ class JsonObjectConstIterator { | ||||
|   } | ||||
|  | ||||
|  private: | ||||
|   const VariantSlot* _slot; | ||||
|   const detail::VariantSlot* _slot; | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -8,14 +8,14 @@ | ||||
| #include <ArduinoJson/Variant/JsonVariant.hpp> | ||||
| #include <ArduinoJson/Variant/JsonVariantConst.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE | ||||
|  | ||||
| // A key-value pair. | ||||
| // https://arduinojson.org/v6/api/jsonobject/begin_end/ | ||||
| class JsonPair { | ||||
|  public: | ||||
|   // INTERNAL USE ONLY | ||||
|   JsonPair(MemoryPool* pool, VariantSlot* slot) { | ||||
|   JsonPair(detail::MemoryPool* pool, detail::VariantSlot* slot) { | ||||
|     if (slot) { | ||||
|       _key = JsonString(slot->key(), slot->ownsKey() ? JsonString::Copied | ||||
|                                                      : JsonString::Linked); | ||||
| @@ -42,7 +42,7 @@ class JsonPair { | ||||
| // https://arduinojson.org/v6/api/jsonobjectconst/begin_end/ | ||||
| class JsonPairConst { | ||||
|  public: | ||||
|   JsonPairConst(const VariantSlot* slot) { | ||||
|   JsonPairConst(const detail::VariantSlot* slot) { | ||||
|     if (slot) { | ||||
|       _key = JsonString(slot->key(), slot->ownsKey() ? JsonString::Copied | ||||
|                                                      : JsonString::Linked); | ||||
| @@ -64,4 +64,5 @@ class JsonPairConst { | ||||
|   JsonString _key; | ||||
|   JsonVariantConst _value; | ||||
| }; | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PUBLIC_NAMESPACE | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| #include <ArduinoJson/Variant/VariantRefBase.hpp> | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| // A proxy class to get or set a member of an object. | ||||
| // https://arduinojson.org/v6/api/jsonobject/subscript/ | ||||
| @@ -61,4 +61,4 @@ class MemberProxy | ||||
|   TStringRef _key; | ||||
| }; | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include <ArduinoJson/Configuration.hpp> | ||||
| #include "math.hpp" | ||||
|  | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
| ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE | ||||
|  | ||||
| template <typename T, typename F> | ||||
| struct alias_cast_t { | ||||
| @@ -26,4 +26,5 @@ T alias_cast(F raw_data) { | ||||
|   ac.raw = raw_data; | ||||
|   return ac.data; | ||||
| } | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user