mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
MemberProxy.link()
This commit is contained in:
@@ -277,3 +277,11 @@ TEST_CASE("MemberProxy::createNestedObject(key)") {
|
|||||||
|
|
||||||
CHECK(doc["status"]["weather"]["temp"] == 42);
|
CHECK(doc["status"]["weather"]["temp"] == 42);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("MemberProxy::link()") {
|
||||||
|
StaticJsonDocument<1024> doc1, doc2;
|
||||||
|
doc1["obj"].link(doc2);
|
||||||
|
doc2["hello"] = "world";
|
||||||
|
|
||||||
|
CHECK(doc1.as<std::string>() == "{\"obj\":{\"hello\":\"world\"}}");
|
||||||
|
}
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ class MemberProxy : public VariantOperators<MemberProxy<TObject, TStringRef> >,
|
|||||||
getUpstreamMember().remove(key);
|
getUpstreamMember().remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE void link(VariantConstRef value) {
|
||||||
|
getOrAddUpstreamMember().link(value);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TValue>
|
template <typename TValue>
|
||||||
FORCE_INLINE typename VariantTo<TValue>::type to() {
|
FORCE_INLINE typename VariantTo<TValue>::type to() {
|
||||||
return getOrAddUpstreamMember().template to<TValue>();
|
return getOrAddUpstreamMember().template to<TValue>();
|
||||||
|
|||||||
Reference in New Issue
Block a user