From 527dc197945adbdf07f7b6de038513aa7d48de03 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Tue, 2 Oct 2018 16:54:05 +0200 Subject: [PATCH] Allow mixed configuration in compilation units (issue #809) --- CHANGELOG.md | 1 + src/ArduinoJson.hpp | 15 +- src/ArduinoJson/Configuration.hpp | 30 +-- src/ArduinoJson/Data/IsVariant.hpp | 6 +- src/ArduinoJson/Data/JsonFloat.hpp | 6 +- src/ArduinoJson/Data/JsonInteger.hpp | 13 +- src/ArduinoJson/Data/JsonVariantAs.hpp | 6 +- src/ArduinoJson/Data/JsonVariantContent.hpp | 6 +- src/ArduinoJson/Data/JsonVariantData.hpp | 6 +- src/ArduinoJson/Data/JsonVariantTo.hpp | 7 +- src/ArduinoJson/Data/JsonVariantType.hpp | 8 +- src/ArduinoJson/Data/Slot.hpp | 6 +- .../Deserialization/ArduinoStreamReader.hpp | 6 +- .../Deserialization/CharPointerReader.hpp | 6 +- .../Deserialization/DeserializationError.hpp | 4 +- .../Deserialization/FlashStringReader.hpp | 6 +- .../Deserialization/IteratorReader.hpp | 6 +- .../Deserialization/StdStreamReader.hpp | 6 +- .../Deserialization/deserialize.hpp | 13 +- src/ArduinoJson/DynamicJsonDocument.hpp | 16 +- src/ArduinoJson/Json/EscapeSequence.hpp | 6 +- src/ArduinoJson/Json/IndentedPrint.hpp | 6 +- src/ArduinoJson/Json/JsonDeserializer.hpp | 12 +- src/ArduinoJson/Json/JsonSerializer.hpp | 13 +- src/ArduinoJson/Json/JsonWriter.hpp | 6 +- src/ArduinoJson/Json/PrettyJsonSerializer.hpp | 9 +- src/ArduinoJson/Json/Prettyfier.hpp | 6 +- src/ArduinoJson/JsonArray.hpp | 30 +-- src/ArduinoJson/JsonArrayImpl.hpp | 4 +- src/ArduinoJson/JsonArrayIterator.hpp | 16 +- src/ArduinoJson/JsonArraySubscript.hpp | 15 +- src/ArduinoJson/JsonObject.hpp | 70 +++-- src/ArduinoJson/JsonObjectImpl.hpp | 4 +- src/ArduinoJson/JsonObjectIterator.hpp | 16 +- src/ArduinoJson/JsonObjectSubscript.hpp | 6 +- src/ArduinoJson/JsonPair.hpp | 6 +- src/ArduinoJson/JsonVariant.hpp | 247 ++++++++---------- src/ArduinoJson/JsonVariantBase.hpp | 6 +- src/ArduinoJson/JsonVariantCasts.hpp | 6 +- src/ArduinoJson/JsonVariantComparisons.hpp | 8 +- src/ArduinoJson/JsonVariantImpl.hpp | 51 ++-- src/ArduinoJson/JsonVariantOr.hpp | 6 +- src/ArduinoJson/JsonVariantSubscripts.hpp | 6 +- .../Memory/AllocableInMemoryPool.hpp | 6 +- src/ArduinoJson/Memory/DynamicMemoryPool.hpp | 6 +- src/ArduinoJson/Memory/MemoryPool.hpp | 6 +- src/ArduinoJson/Memory/StaticMemoryPool.hpp | 6 +- .../MsgPack/MsgPackDeserializer.hpp | 14 +- src/ArduinoJson/MsgPack/MsgPackSerializer.hpp | 13 +- src/ArduinoJson/MsgPack/endianess.hpp | 6 +- src/ArduinoJson/MsgPack/ieee754.hpp | 6 +- src/ArduinoJson/Namespace.hpp | 22 ++ src/ArduinoJson/Numbers/FloatParts.hpp | 6 +- src/ArduinoJson/Numbers/FloatTraits.hpp | 6 +- src/ArduinoJson/Numbers/isFloat.hpp | 6 +- src/ArduinoJson/Numbers/isInteger.hpp | 6 +- src/ArduinoJson/Numbers/parseFloat.hpp | 6 +- src/ArduinoJson/Numbers/parseInteger.hpp | 6 +- src/ArduinoJson/Polyfills/ctype.hpp | 6 +- src/ArduinoJson/Polyfills/math.hpp | 6 +- src/ArduinoJson/Polyfills/mpl/max.hpp | 6 +- .../Polyfills/type_traits/enable_if.hpp | 6 +- .../type_traits/integral_constant.hpp | 6 +- .../Polyfills/type_traits/is_array.hpp | 6 +- .../Polyfills/type_traits/is_base_of.hpp | 6 +- .../Polyfills/type_traits/is_const.hpp | 6 +- .../type_traits/is_floating_point.hpp | 6 +- .../Polyfills/type_traits/is_integral.hpp | 15 +- .../Polyfills/type_traits/is_same.hpp | 6 +- .../Polyfills/type_traits/is_signed.hpp | 11 +- .../Polyfills/type_traits/is_unsigned.hpp | 17 +- .../Polyfills/type_traits/remove_const.hpp | 6 +- .../type_traits/remove_reference.hpp | 6 +- src/ArduinoJson/Polyfills/utility.hpp | 6 +- src/ArduinoJson/Serialization/DummyWriter.hpp | 6 +- .../Serialization/DynamicStringWriter.hpp | 6 +- .../Serialization/StaticStringWriter.hpp | 6 +- .../Serialization/StreamWriter.hpp | 6 +- src/ArduinoJson/Serialization/measure.hpp | 6 +- src/ArduinoJson/Serialization/serialize.hpp | 6 +- src/ArduinoJson/SerializedValue.hpp | 18 +- src/ArduinoJson/StaticJsonDocument.hpp | 16 +- .../StringStorage/StringCopier.hpp | 6 +- src/ArduinoJson/StringStorage/StringMover.hpp | 6 +- .../StringStorage/StringStorage.hpp | 6 +- src/ArduinoJson/Strings/ArduinoString.hpp | 6 +- .../Strings/FixedSizeFlashString.hpp | 6 +- .../Strings/FixedSizeRamString.hpp | 6 +- src/ArduinoJson/Strings/StlString.hpp | 6 +- src/ArduinoJson/Strings/StringTypes.hpp | 6 +- .../Strings/ZeroTerminatedFlashString.hpp | 6 +- .../Strings/ZeroTerminatedRamString.hpp | 6 +- test/CMakeLists.txt | 1 + test/DynamicMemoryPool/alloc.cpp | 2 +- test/DynamicMemoryPool/no_memory.cpp | 2 +- test/DynamicMemoryPool/size.cpp | 2 +- test/DynamicMemoryPool/startString.cpp | 2 +- test/JsonArray/subscript.cpp | 4 +- .../JsonDeserializer/deserializeJsonValue.cpp | 13 +- test/JsonSerializer/JsonVariant.cpp | 2 +- test/JsonVariant/as.cpp | 2 +- test/JsonVariant/set_get.cpp | 8 +- test/JsonWriter/writeFloat.cpp | 2 +- test/JsonWriter/writeString.cpp | 2 +- test/Misc/FloatParts.cpp | 2 +- test/Misc/StringWriter.cpp | 2 +- test/Misc/TypeTraits.cpp | 2 +- test/MixedConfiguration/CMakeLists.txt | 16 ++ test/MixedConfiguration/use_double_0.cpp | 17 ++ test/MixedConfiguration/use_double_1.cpp | 17 ++ test/MixedConfiguration/use_long_long_0.cpp | 30 +++ test/MixedConfiguration/use_long_long_1.cpp | 17 ++ .../deserializeVariant.cpp | 4 +- test/MsgPackDeserializer/doubleToFloat.cpp | 4 +- test/MsgPackSerializer/serializeVariant.cpp | 4 +- test/Numbers/isFloat.cpp | 2 +- test/Numbers/isInteger.cpp | 2 +- test/Numbers/parseFloat.cpp | 2 +- test/Numbers/parseInteger.cpp | 2 +- test/StaticMemoryPool/alloc.cpp | 2 +- test/StaticMemoryPool/size.cpp | 2 +- test/StaticMemoryPool/startString.cpp | 2 +- 122 files changed, 580 insertions(+), 691 deletions(-) create mode 100644 src/ArduinoJson/Namespace.hpp create mode 100644 test/MixedConfiguration/CMakeLists.txt create mode 100644 test/MixedConfiguration/use_double_0.cpp create mode 100644 test/MixedConfiguration/use_double_1.cpp create mode 100644 test/MixedConfiguration/use_long_long_0.cpp create mode 100644 test/MixedConfiguration/use_long_long_1.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7bbd87..b1293c1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ HEAD ---- * Added implicit conversion from `JsonArray` and `JsonObject` to `JsonVariant` +* Allow mixed configuration in compilation units (issue #809) v6.4.0-beta (2018-09-11) ----------- diff --git a/src/ArduinoJson.hpp b/src/ArduinoJson.hpp index 949e6c30..11e8127b 100644 --- a/src/ArduinoJson.hpp +++ b/src/ArduinoJson.hpp @@ -4,7 +4,7 @@ #pragma once -#include "ArduinoJson/version.hpp" +#include "ArduinoJson/Namespace.hpp" #include "ArduinoJson/DynamicJsonDocument.hpp" #include "ArduinoJson/StaticJsonDocument.hpp" @@ -24,3 +24,16 @@ #include "ArduinoJson/Json/PrettyJsonSerializer.hpp" #include "ArduinoJson/MsgPack/MsgPackDeserializer.hpp" #include "ArduinoJson/MsgPack/MsgPackSerializer.hpp" + +namespace ArduinoJson { +using ARDUINOJSON_NAMESPACE::DeserializationError; +using ARDUINOJSON_NAMESPACE::DynamicJsonDocument; +using ARDUINOJSON_NAMESPACE::JsonArray; +using ARDUINOJSON_NAMESPACE::JsonFloat; +using ARDUINOJSON_NAMESPACE::JsonInteger; +using ARDUINOJSON_NAMESPACE::JsonObject; +using ARDUINOJSON_NAMESPACE::JsonUInt; +using ARDUINOJSON_NAMESPACE::JsonVariant; +using ARDUINOJSON_NAMESPACE::serialized; +using ARDUINOJSON_NAMESPACE::StaticJsonDocument; +} // namespace ArduinoJson diff --git a/src/ArduinoJson/Configuration.hpp b/src/ArduinoJson/Configuration.hpp index af4ea0b5..914dd1de 100644 --- a/src/ArduinoJson/Configuration.hpp +++ b/src/ArduinoJson/Configuration.hpp @@ -4,6 +4,18 @@ #pragma once +#if defined(_MSC_VER) +#define ARDUINOJSON_HAS_INT64 1 +#else +#define ARDUINOJSON_HAS_INT64 0 +#endif + +#if __cplusplus >= 201103L +#define ARDUINOJSON_HAS_LONG_LONG 1 +#else +#define ARDUINOJSON_HAS_LONG_LONG 0 +#endif + // Small or big machine? #ifndef ARDUINOJSON_EMBEDDED_MODE #if defined(ARDUINO) || defined(__IAR_SYSTEMS_ICC__) || defined(__XC) || \ @@ -25,9 +37,6 @@ #ifndef ARDUINOJSON_USE_LONG_LONG #define ARDUINOJSON_USE_LONG_LONG 0 #endif -#ifndef ARDUINOJSON_USE_INT64 -#define ARDUINOJSON_USE_INT64 0 -#endif // Embedded systems usually don't have std::string #ifndef ARDUINOJSON_ENABLE_STD_STRING @@ -53,22 +62,13 @@ // Use long long when available #ifndef ARDUINOJSON_USE_LONG_LONG -#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64 #define ARDUINOJSON_USE_LONG_LONG 1 #else #define ARDUINOJSON_USE_LONG_LONG 0 #endif #endif -// Use _int64 on old versions of Visual Studio -#ifndef ARDUINOJSON_USE_INT64 -#if defined(_MSC_VER) && _MSC_VER <= 1700 -#define ARDUINOJSON_USE_INT64 1 -#else -#define ARDUINOJSON_USE_INT64 0 -#endif -#endif - // On a computer, we can use std::string #ifndef ARDUINOJSON_ENABLE_STD_STRING #define ARDUINOJSON_ENABLE_STD_STRING 1 @@ -141,10 +141,6 @@ #define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5 #endif -#if ARDUINOJSON_USE_LONG_LONG && ARDUINOJSON_USE_INT64 -#error ARDUINOJSON_USE_LONG_LONG and ARDUINOJSON_USE_INT64 cannot be set together -#endif - #ifndef ARDUINOJSON_LITTLE_ENDIAN #if defined(_MSC_VER) || \ (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \ diff --git a/src/ArduinoJson/Data/IsVariant.hpp b/src/ArduinoJson/Data/IsVariant.hpp index 2c543417..ae3659b2 100644 --- a/src/ArduinoJson/Data/IsVariant.hpp +++ b/src/ArduinoJson/Data/IsVariant.hpp @@ -6,12 +6,10 @@ #include "../Polyfills/type_traits.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { class JsonVariantTag {}; template struct IsVariant : is_base_of {}; -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonFloat.hpp b/src/ArduinoJson/Data/JsonFloat.hpp index 0ed42140..2f6e9570 100644 --- a/src/ArduinoJson/Data/JsonFloat.hpp +++ b/src/ArduinoJson/Data/JsonFloat.hpp @@ -6,13 +6,11 @@ #include "../Configuration.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { #if ARDUINOJSON_USE_DOUBLE typedef double JsonFloat; #else typedef float JsonFloat; #endif -} -} +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonInteger.hpp b/src/ArduinoJson/Data/JsonInteger.hpp index c8ddd00b..650d5854 100644 --- a/src/ArduinoJson/Data/JsonInteger.hpp +++ b/src/ArduinoJson/Data/JsonInteger.hpp @@ -6,18 +6,13 @@ #include "../Configuration.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { #if ARDUINOJSON_USE_LONG_LONG -typedef long long JsonInteger; -typedef unsigned long long JsonUInt; -#elif ARDUINOJSON_USE_INT64 -typedef __int64 JsonInteger; -typedef unsigned _int64 JsonUInt; +typedef int64_t JsonInteger; +typedef uint64_t JsonUInt; #else typedef long JsonInteger; typedef unsigned long JsonUInt; #endif -} -} +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonVariantAs.hpp b/src/ArduinoJson/Data/JsonVariantAs.hpp index a3a08479..34b4a6b2 100644 --- a/src/ArduinoJson/Data/JsonVariantAs.hpp +++ b/src/ArduinoJson/Data/JsonVariantAs.hpp @@ -4,8 +4,7 @@ #pragma once -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { // A metafunction that returns the type of the value returned by // JsonVariant::as() @@ -19,5 +18,4 @@ struct JsonVariantAs { typedef const char* type; }; -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonVariantContent.hpp b/src/ArduinoJson/Data/JsonVariantContent.hpp index e7d6e415..63597c76 100644 --- a/src/ArduinoJson/Data/JsonVariantContent.hpp +++ b/src/ArduinoJson/Data/JsonVariantContent.hpp @@ -9,8 +9,7 @@ #include "JsonFloat.hpp" #include "JsonInteger.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { struct JsonObjectData { struct Slot* head; struct Slot* tail; @@ -40,5 +39,4 @@ union JsonVariantContent { } asRaw; }; -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonVariantData.hpp b/src/ArduinoJson/Data/JsonVariantData.hpp index 7a148f62..af9dcabb 100644 --- a/src/ArduinoJson/Data/JsonVariantData.hpp +++ b/src/ArduinoJson/Data/JsonVariantData.hpp @@ -7,8 +7,7 @@ #include "JsonVariantContent.hpp" #include "JsonVariantType.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { // this struct must be a POD type to prevent error calling offsetof on clang struct JsonVariantData { @@ -31,5 +30,4 @@ inline JsonVariantData *getVariantData(JsonObjectData *obj) { return reinterpret_cast(reinterpret_cast(obj) - offset); } -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonVariantTo.hpp b/src/ArduinoJson/Data/JsonVariantTo.hpp index cc73dfb6..5b5d4f0a 100644 --- a/src/ArduinoJson/Data/JsonVariantTo.hpp +++ b/src/ArduinoJson/Data/JsonVariantTo.hpp @@ -4,13 +4,11 @@ #pragma once -namespace ArduinoJson { +namespace ARDUINOJSON_NAMESPACE { class JsonArray; class JsonObject; class JsonVariant; -namespace Internals { - // A metafunction that returns the type of the value returned by // JsonVariant::to() template @@ -29,5 +27,4 @@ struct JsonVariantTo { typedef JsonVariant type; }; -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/JsonVariantType.hpp b/src/ArduinoJson/Data/JsonVariantType.hpp index 8cf6df50..b83efce0 100644 --- a/src/ArduinoJson/Data/JsonVariantType.hpp +++ b/src/ArduinoJson/Data/JsonVariantType.hpp @@ -4,10 +4,7 @@ #pragma once -namespace ArduinoJson { - -namespace Internals { - +namespace ARDUINOJSON_NAMESPACE { // Enumerated type to know the current type of a JsonVariant. // The value determines which member of JsonVariantContent is used. enum JsonVariantType { @@ -23,5 +20,4 @@ enum JsonVariantType { JSON_OBJECT, JSON_FLOAT }; -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Data/Slot.hpp b/src/ArduinoJson/Data/Slot.hpp index 72ce7da9..db603b95 100644 --- a/src/ArduinoJson/Data/Slot.hpp +++ b/src/ArduinoJson/Data/Slot.hpp @@ -7,8 +7,7 @@ #include "../Memory/AllocableInMemoryPool.hpp" #include "JsonVariantData.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { struct Slot : AllocableInMemoryPool { JsonVariantData value; @@ -17,5 +16,4 @@ struct Slot : AllocableInMemoryPool { const char* key; }; -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp b/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp index 53260657..9f12ddbe 100644 --- a/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp +++ b/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp @@ -8,8 +8,7 @@ #include -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { struct ArduinoStreamReader { Stream& _stream; @@ -35,7 +34,6 @@ struct ArduinoStreamReader { inline ArduinoStreamReader makeReader(Stream& input) { return ArduinoStreamReader(input); } -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE #endif diff --git a/src/ArduinoJson/Deserialization/CharPointerReader.hpp b/src/ArduinoJson/Deserialization/CharPointerReader.hpp index 8414f84a..56a09dfb 100644 --- a/src/ArduinoJson/Deserialization/CharPointerReader.hpp +++ b/src/ArduinoJson/Deserialization/CharPointerReader.hpp @@ -4,8 +4,7 @@ #pragma once -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { template class UnsafeCharPointerReader { @@ -60,5 +59,4 @@ inline SafeCharPointerReader makeReader(const String& input) { } #endif -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Deserialization/DeserializationError.hpp b/src/ArduinoJson/Deserialization/DeserializationError.hpp index 724f2ab9..92a868b6 100644 --- a/src/ArduinoJson/Deserialization/DeserializationError.hpp +++ b/src/ArduinoJson/Deserialization/DeserializationError.hpp @@ -8,7 +8,7 @@ #include #endif -namespace ArduinoJson { +namespace ARDUINOJSON_NAMESPACE { class DeserializationError { public: @@ -80,4 +80,4 @@ inline std::ostream& operator<<(std::ostream& s, DeserializationError::Code c) { } #endif -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Deserialization/FlashStringReader.hpp b/src/ArduinoJson/Deserialization/FlashStringReader.hpp index 2eabf798..e9fd57e6 100644 --- a/src/ArduinoJson/Deserialization/FlashStringReader.hpp +++ b/src/ArduinoJson/Deserialization/FlashStringReader.hpp @@ -6,8 +6,7 @@ #if ARDUINOJSON_ENABLE_PROGMEM -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { class UnsafeFlashStringReader { const char* _ptr; @@ -50,7 +49,6 @@ inline SafeFlashStringReader makeReader(const __FlashStringHelper* input, size_t size) { return SafeFlashStringReader(input, size); } -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE #endif diff --git a/src/ArduinoJson/Deserialization/IteratorReader.hpp b/src/ArduinoJson/Deserialization/IteratorReader.hpp index 7e01c214..ce33c3a8 100644 --- a/src/ArduinoJson/Deserialization/IteratorReader.hpp +++ b/src/ArduinoJson/Deserialization/IteratorReader.hpp @@ -4,8 +4,7 @@ #pragma once -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { template class IteratorReader { @@ -30,5 +29,4 @@ inline IteratorReader makeReader( return IteratorReader(input.begin(), input.end()); } -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE diff --git a/src/ArduinoJson/Deserialization/StdStreamReader.hpp b/src/ArduinoJson/Deserialization/StdStreamReader.hpp index 8ad841a7..2db44194 100644 --- a/src/ArduinoJson/Deserialization/StdStreamReader.hpp +++ b/src/ArduinoJson/Deserialization/StdStreamReader.hpp @@ -8,8 +8,7 @@ #include -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { class StdStreamReader { std::istream& _stream; @@ -34,7 +33,6 @@ class StdStreamReader { inline StdStreamReader makeReader(std::istream& input) { return StdStreamReader(input); } -} // namespace Internals -} // namespace ArduinoJson +} // namespace ARDUINOJSON_NAMESPACE #endif diff --git a/src/ArduinoJson/Deserialization/deserialize.hpp b/src/ArduinoJson/Deserialization/deserialize.hpp index a32bbdd3..fedea7f4 100644 --- a/src/ArduinoJson/Deserialization/deserialize.hpp +++ b/src/ArduinoJson/Deserialization/deserialize.hpp @@ -12,8 +12,7 @@ #include "./IteratorReader.hpp" #include "./StdStreamReader.hpp" -namespace ArduinoJson { -namespace Internals { +namespace ARDUINOJSON_NAMESPACE { template