Implement standard-library-compatible iterators for Dictionary

This commit is contained in:
Tim Wojtulewicz 2020-09-22 13:59:13 -07:00
parent 9e9998c6e5
commit 892124378c
16 changed files with 834 additions and 254 deletions

View file

@ -34,14 +34,13 @@ std::set<std::string> val_to_topic_set(zeek::Val* val)
if ( tbl->Length() == 0 )
return rval;
zeek::IterCookie* c = tbl->InitForIteration();
zeek::detail::HashKey* k;
while ( tbl->NextEntry(k, c) )
for ( const auto& te : *tbl )
{
auto k = te.GetHashKey();
auto* v = te.GetValue<zeek::TableEntryVal*>();
auto index = val->AsTableVal()->RecreateIndex(*k);
rval.emplace(index->Idx(0)->AsString()->CheckString());
delete k;
}
}