forked from bblanchon/ArduinoJson
Add a stub for shallowCopy()
This commit is contained in:
@ -18,6 +18,7 @@ add_executable(DeprecatedTests
|
||||
BasicJsonDocument.cpp
|
||||
DynamicJsonDocument.cpp
|
||||
memoryUsage.cpp
|
||||
shallowCopy.cpp
|
||||
StaticJsonDocument.cpp
|
||||
)
|
||||
|
||||
|
14
extras/tests/Deprecated/shallowCopy.cpp
Normal file
14
extras/tests/Deprecated/shallowCopy.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// ArduinoJson - https://arduinojson.org
|
||||
// Copyright © 2014-2023, Benoit BLANCHON
|
||||
// MIT License
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("shallowCopy()") {
|
||||
JsonDocument doc1, doc2;
|
||||
doc1["b"] = "c";
|
||||
doc2["a"].shallowCopy(doc1);
|
||||
|
||||
REQUIRE(doc2.as<std::string>() == "{\"a\":{\"b\":\"c\"}}");
|
||||
}
|
@ -227,6 +227,12 @@ class VariantRefBase : public VariantTag {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// DEPRECATED: performs a deep copy
|
||||
ARDUINOJSON_DEPRECATED("performs a deep copy")
|
||||
void shallowCopy(JsonVariantConst src) const {
|
||||
set(src);
|
||||
}
|
||||
|
||||
private:
|
||||
TDerived& derived() {
|
||||
return static_cast<TDerived&>(*this);
|
||||
|
Reference in New Issue
Block a user