Commit fbfbc568 authored by Max Kellermann's avatar Max Kellermann

lib/dbus/ReadIter: add ForEachRecurse()

parent d4141bf7
......@@ -70,8 +70,8 @@ template<typename F>
inline void
ForEachInterface(ReadMessageIter &&i, F &&f)
{
i.ForEach(DBUS_TYPE_DICT_ENTRY, [&f](auto &&j){
RecurseInterfaceDictEntry(j.Recurse(), f);
i.ForEachRecurse(DBUS_TYPE_DICT_ENTRY, [&f](auto &&j){
RecurseInterfaceDictEntry(std::move(j), f);
});
}
......
......@@ -91,6 +91,17 @@ public:
for (; GetArgType() == arg_type; Next())
f(*this);
}
/**
* Wrapper for ForEach() which passes a recursed iterator for
* each element.
*/
template<typename F>
void ForEachRecurse(int arg_type, F &&f) {
ForEach(arg_type, [&f](auto &&i){
f(i.Recurse());
});
}
};
} /* namespace ODBus */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment