mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 00:32:37 +01:00 
			
		
		
		
	Renamed undocumented function isUndefined() to isUnbound()
				
					
				
			This commit is contained in:
		| @@ -12,11 +12,13 @@ HEAD | ||||
| * Add safe bool idiom in `JsonString` | ||||
| * Add support for NUL in string values (issue #1646) | ||||
| * Remove `DeserializationError == bool` and `DeserializationError != bool` | ||||
| * Renamed undocumented function `isUndefined()` to `isUnbound()` | ||||
| * Fix `JsonVariant::memoryUsage()` for raw strings | ||||
| * Fix `call of overloaded 'swap(BasicJsonDocument&, BasicJsonDocument&)' is ambiguous` (issue #1678) | ||||
| * Fix inconsistent pool capacity between `BasicJsonDocument`'s copy and move constructors | ||||
| * Fix inconsistent pool capacity between `BasicJsonDocument`'s copy and move assignments | ||||
| * Fix return type of `StaticJsonDocument::operator=` | ||||
| * Avoid pool reallocation in `BasicJsonDocument`'s copy assignment if capacity is the same | ||||
|  | ||||
| v6.18.5 (2021-09-28) | ||||
| ------- | ||||
|   | ||||
| @@ -17,7 +17,7 @@ add_executable(JsonArrayTests | ||||
| 	size.cpp | ||||
| 	std_string.cpp | ||||
| 	subscript.cpp | ||||
| 	undefined.cpp | ||||
| 	unbound.cpp | ||||
| ) | ||||
|  | ||||
| add_test(JsonArray JsonArrayTests) | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| 
 | ||||
| using namespace Catch::Matchers; | ||||
| 
 | ||||
| TEST_CASE("Undefined JsonArray") { | ||||
| TEST_CASE("Unbound JsonArray") { | ||||
|   JsonArray array; | ||||
| 
 | ||||
|   SECTION("SubscriptFails") { | ||||
| @@ -22,7 +22,7 @@ add_executable(JsonVariantTests | ||||
| 	set.cpp | ||||
| 	subscript.cpp | ||||
| 	types.cpp | ||||
| 	undefined.cpp | ||||
| 	unbound.cpp | ||||
| ) | ||||
|  | ||||
| add_test(JsonVariant JsonVariantTests) | ||||
|   | ||||
| @@ -89,7 +89,7 @@ TEST_CASE("JsonVariant::set(JsonVariant)") { | ||||
|  | ||||
|     unboundVariant.set(var1); | ||||
|  | ||||
|     REQUIRE(unboundVariant.isUndefined()); | ||||
|     REQUIRE(unboundVariant.isUnbound()); | ||||
|     REQUIRE(unboundVariant.isNull()); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -11,7 +11,7 @@ TEST_CASE("JsonVariant::is<T>()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   JsonVariant variant = doc.to<JsonVariant>(); | ||||
|  | ||||
|   SECTION("undefined") { | ||||
|   SECTION("unbound") { | ||||
|     variant = JsonVariant(); | ||||
|  | ||||
|     CHECK(variant.is<JsonObject>() == false); | ||||
| @@ -168,7 +168,7 @@ TEST_CASE("JsonVariantConst::is<T>()") { | ||||
|   JsonVariant variant = doc.to<JsonVariant>(); | ||||
|   JsonVariantConst cvariant = variant; | ||||
|  | ||||
|   SECTION("undefined") { | ||||
|   SECTION("unbound") { | ||||
|     cvariant = JsonVariantConst(); | ||||
|  | ||||
|     CHECK(cvariant.is<JsonArray>() == false); | ||||
|   | ||||
| @@ -9,30 +9,30 @@ TEST_CASE("JsonVariant::operator|()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   JsonVariant variant = doc["value"].to<JsonVariant>(); | ||||
|  | ||||
|   SECTION("undefined") { | ||||
|     SECTION("undefined | const char*") { | ||||
|   SECTION("null") { | ||||
|     SECTION("null | const char*") { | ||||
|       std::string result = variant | "default"; | ||||
|       REQUIRE(result == "default"); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | int") { | ||||
|     SECTION("null | int") { | ||||
|       int result = variant | 42; | ||||
|       REQUIRE(result == 42); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | bool") { | ||||
|     SECTION("null | bool") { | ||||
|       bool result = variant | true; | ||||
|       REQUIRE(result == true); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | ElementProxy") { | ||||
|     SECTION("null | ElementProxy") { | ||||
|       doc["array"][0] = 42; | ||||
|  | ||||
|       JsonVariantConst result = variant | doc["array"][0]; | ||||
|       REQUIRE(result == 42); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | MemberProxy") { | ||||
|     SECTION("null | MemberProxy") { | ||||
|       doc["other"] = 42; | ||||
|  | ||||
|       JsonVariantConst result = variant | doc["other"]; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ TEST_CASE("JsonVariant::operator[]") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   JsonVariant var = doc.to<JsonVariant>(); | ||||
|  | ||||
|   SECTION("The JsonVariant is undefined") { | ||||
|   SECTION("The JsonVariant is null") { | ||||
|     REQUIRE(0 == var.size()); | ||||
|     REQUIRE(var["0"].isNull()); | ||||
|     REQUIRE(var[0].isNull()); | ||||
| @@ -136,7 +136,7 @@ TEST_CASE("JsonVariantConst::operator[]") { | ||||
|   JsonVariant var = doc.to<JsonVariant>(); | ||||
|   JsonVariantConst cvar = var; | ||||
|  | ||||
|   SECTION("The JsonVariant is undefined") { | ||||
|   SECTION("The JsonVariant is null") { | ||||
|     REQUIRE(0 == cvar.size()); | ||||
|     REQUIRE(cvar["0"].isNull()); | ||||
|     REQUIRE(cvar[0].isNull()); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
| 
 | ||||
| TEST_CASE("JsonVariant undefined") { | ||||
| TEST_CASE("Unbound JsonVariant") { | ||||
|   JsonVariant variant; | ||||
| 
 | ||||
|   SECTION("as<T>()") { | ||||
| @@ -31,7 +31,7 @@ static void checkVariant(T value, const std::string& expected) { | ||||
| } | ||||
|  | ||||
| TEST_CASE("serialize MsgPack value") { | ||||
|   SECTION("undefined") { | ||||
|   SECTION("unbound") { | ||||
|     checkVariant(JsonVariant(), "\xC0");  // we represent undefined as nil | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -139,14 +139,14 @@ class JsonDocument : public Visitable { | ||||
|   // containsKey(const __FlashStringHelper*) const | ||||
|   template <typename TChar> | ||||
|   bool containsKey(TChar* key) const { | ||||
|     return !getMember(key).isUndefined(); | ||||
|     return !getMember(key).isUnbound(); | ||||
|   } | ||||
|  | ||||
|   // containsKey(const std::string&) const | ||||
|   // containsKey(const String&) const | ||||
|   template <typename TString> | ||||
|   bool containsKey(const TString& key) const { | ||||
|     return !getMember(key).isUndefined(); | ||||
|     return !getMember(key).isUnbound(); | ||||
|   } | ||||
|  | ||||
|   // operator[](const std::string&) | ||||
|   | ||||
| @@ -40,14 +40,14 @@ template <typename TObject> | ||||
| template <typename TString> | ||||
| inline typename enable_if<IsString<TString>::value, bool>::type | ||||
| ObjectShortcuts<TObject>::containsKey(const TString& key) const { | ||||
|   return !impl()->getMember(key).isUndefined(); | ||||
|   return !impl()->getMember(key).isUnbound(); | ||||
| } | ||||
|  | ||||
| template <typename TObject> | ||||
| template <typename TChar> | ||||
| inline typename enable_if<IsString<TChar*>::value, bool>::type | ||||
| ObjectShortcuts<TObject>::containsKey(TChar* key) const { | ||||
|   return !impl()->getMember(key).isUndefined(); | ||||
|   return !impl()->getMember(key).isUnbound(); | ||||
| } | ||||
|  | ||||
| template <typename TObject> | ||||
|   | ||||
| @@ -77,7 +77,7 @@ class ObjectConstRef : public ObjectRefBase<const CollectionData>, | ||||
|   // containsKey(const String&) const | ||||
|   template <typename TString> | ||||
|   FORCE_INLINE bool containsKey(const TString& key) const { | ||||
|     return !getMember(key).isUndefined(); | ||||
|     return !getMember(key).isUnbound(); | ||||
|   } | ||||
|  | ||||
|   // containsKey(char*) const | ||||
| @@ -85,7 +85,7 @@ class ObjectConstRef : public ObjectRefBase<const CollectionData>, | ||||
|   // containsKey(const __FlashStringHelper*) const | ||||
|   template <typename TChar> | ||||
|   FORCE_INLINE bool containsKey(TChar* key) const { | ||||
|     return !getMember(key).isUndefined(); | ||||
|     return !getMember(key).isUnbound(); | ||||
|   } | ||||
|  | ||||
|   // getMember(const std::string&) const | ||||
|   | ||||
| @@ -17,7 +17,7 @@ CompareResult compare(const T1 &lhs, const T2 &rhs);  // VariantCompare.cpp | ||||
|  | ||||
| template <typename TVariant> | ||||
| struct VariantOperators { | ||||
|   // Returns the default value if the VariantRef is undefined or incompatible | ||||
|   // Returns the default value if the VariantRef is unbound or incompatible | ||||
|   // | ||||
|   // int operator|(JsonVariant, int) | ||||
|   // float operator|(JsonVariant, float) | ||||
|   | ||||
| @@ -32,7 +32,7 @@ class VariantRefBase : public VariantTag { | ||||
|     return variantIsNull(_data); | ||||
|   } | ||||
|  | ||||
|   FORCE_INLINE bool isUndefined() const { | ||||
|   FORCE_INLINE bool isUnbound() const { | ||||
|     return !_data; | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user