summaryrefslogtreecommitdiff
path: root/src/state.cpp
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-06-17 21:58:32 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-06-18 22:41:23 +0200
commite7d6aafd3c9353d9e6169ca775cf1dae618238cd (patch)
tree6df8f296d7db8dd9e7d23f5774009ccc5ee269a7 /src/state.cpp
parent2130d07cbf91e016fd21a730a8449dd4bd34a093 (diff)
Storage: iterable type for record item list
Diffstat (limited to 'src/state.cpp')
-rw-r--r--src/state.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/state.cpp b/src/state.cpp
index 6ad9f89..8e5dcad 100644
--- a/src/state.cpp
+++ b/src/state.cpp
@@ -22,9 +22,7 @@ LocalState::LocalState(const Ref & ref):
if (auto x = rec->item("id").asRef())
p->identity = Identity::load(*x);
- for (auto i : rec->items("shared"))
- if (const auto & x = i.as<SharedData>())
- p->shared.tip.push_back(*x);
+ p->shared.tip = rec->items("shared").as<SharedData>();
if (p->identity) {
vector<Stored<Signed<IdentityData>>> updates;
@@ -158,16 +156,10 @@ SharedData::SharedData(const Ref & ref)
if (!rec)
return;
- for (auto i : rec->items("PREV"))
- if (const auto & x = i.as<SharedData>())
- prev.push_back(*x);
-
+ prev = rec->items("PREV").as<SharedData>();
if (auto x = rec->item("type").asUUID())
type = *x;
-
- for (auto i : rec->items("value"))
- if (const auto & x = i.asRef())
- value.push_back(*x);
+ value = rec->items("value").asRef();
}
Ref SharedData::store(const Storage & st) const