mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Renamed JsonArray::removeAt() into remove()
				
					
				
			This commit is contained in:
		| @@ -6,6 +6,7 @@ HEAD | ||||
|  | ||||
| * Added `JsonArray::remove(iterator)` (issue #479) | ||||
| * Added `JsonObject::remove(iterator)` | ||||
| * Renamed `JsonArray::removeAt(size_t)` into `remove(size_t)` | ||||
|  | ||||
| v5.8.4 | ||||
| ------ | ||||
|   | ||||
| @@ -89,6 +89,8 @@ class List { | ||||
|  | ||||
|  protected: | ||||
|   JsonBuffer *_buffer; | ||||
|  | ||||
|  private: | ||||
|   node_type *_firstNode; | ||||
| }; | ||||
| } | ||||
|   | ||||
| @@ -131,7 +131,7 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>, | ||||
|   JsonObject &createNestedObject(); | ||||
|  | ||||
|   // Removes element at specified index. | ||||
|   void removeAt(size_t index) { | ||||
|   void remove(size_t index) { | ||||
|     remove(begin() += index); | ||||
|   } | ||||
|   using Internals::List<JsonVariant>::remove; | ||||
| @@ -197,6 +197,13 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>, | ||||
|     } | ||||
|   } | ||||
|  | ||||
| #if ARDUINOJSON_ENABLE_DEPRECATED | ||||
|   DEPRECATED("use remove() instead") | ||||
|   FORCE_INLINE void removeAt(size_t index) { | ||||
|     return remove(index); | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|  private: | ||||
|   template <typename TValueRef> | ||||
|   bool set_impl(size_t index, TValueRef value) { | ||||
|   | ||||
| @@ -14,7 +14,7 @@ add_executable(JsonArrayTests | ||||
| 	iterator.cpp | ||||
| 	prettyPrintTo.cpp | ||||
| 	printTo.cpp | ||||
| 	removeAt.cpp | ||||
| 	remove.cpp | ||||
| 	set.cpp | ||||
| 	subscript.cpp | ||||
| ) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class JsonArray_Remove_Tests : public ::testing::Test { | ||||
| #define TEST_(name) TEST_F(JsonArray_Remove_Tests, name) | ||||
| 
 | ||||
| TEST_(RemoveFirstByIndex) { | ||||
|   _array.removeAt(0); | ||||
|   _array.remove(0); | ||||
| 
 | ||||
|   EXPECT_EQ(2, _array.size()); | ||||
|   EXPECT_STREQ("two", _array[0]); | ||||
| @@ -31,7 +31,7 @@ TEST_(RemoveFirstByIndex) { | ||||
| } | ||||
| 
 | ||||
| TEST_(RemoveMiddleByIndex) { | ||||
|   _array.removeAt(1); | ||||
|   _array.remove(1); | ||||
| 
 | ||||
|   EXPECT_EQ(2, _array.size()); | ||||
|   EXPECT_STREQ("one", _array[0]); | ||||
| @@ -39,7 +39,7 @@ TEST_(RemoveMiddleByIndex) { | ||||
| } | ||||
| 
 | ||||
| TEST_(RemoveLastByIndex) { | ||||
|   _array.removeAt(2); | ||||
|   _array.remove(2); | ||||
| 
 | ||||
|   EXPECT_EQ(2, _array.size()); | ||||
|   EXPECT_STREQ("one", _array[0]); | ||||
| @@ -34,3 +34,9 @@ TEST(Deprecated, asString) { | ||||
|   JsonVariant variant = "hello"; | ||||
|   ASSERT_STREQ("hello", variant.asString()); | ||||
| } | ||||
|  | ||||
| TEST(Deprecated, removeAt) { | ||||
|   DynamicJsonBuffer jsonBuffer; | ||||
|   JsonArray& arr = jsonBuffer.createArray(); | ||||
|   arr.removeAt(0); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user