blob: 040ebb4adf4e04c5db21fc89a2a3a695595e879d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <erebos/merge.h>
namespace erebos {
static void findPropertyObjects(vector<Stored<Object>> & candidates, const Stored<Object> & obj, const string & prop)
{
if (auto rec = obj->asRecord()) {
if (rec->item(prop)) {
candidates.push_back(obj);
} else {
for (const auto & r : obj.ref().previous())
findPropertyObjects(candidates, Stored<Object>::load(r), prop);
}
}
}
vector<Stored<Object>> findPropertyObjects(const vector<Stored<Object>> & leaves, const string & prop)
{
vector<Stored<Object>> candidates;
for (const auto & obj : leaves)
findPropertyObjects(candidates, obj, prop);
filterAncestors(candidates);
return candidates;
}
}
|