mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Replace ARDUINOJSON_NAMESPACE with an inline namespace (#1820)
				
					
				
			This commit is contained in:
		| @@ -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}; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user