Commit fbfbc568 authored by Max Kellermann's avatar Max Kellermann

lib/dbus/ReadIter: add ForEachRecurse()

parent d4141bf7
...@@ -70,8 +70,8 @@ template<typename F> ...@@ -70,8 +70,8 @@ template<typename F>
inline void inline void
ForEachInterface(ReadMessageIter &&i, F &&f) ForEachInterface(ReadMessageIter &&i, F &&f)
{ {
i.ForEach(DBUS_TYPE_DICT_ENTRY, [&f](auto &&j){ i.ForEachRecurse(DBUS_TYPE_DICT_ENTRY, [&f](auto &&j){
RecurseInterfaceDictEntry(j.Recurse(), f); RecurseInterfaceDictEntry(std::move(j), f);
}); });
} }
......
...@@ -91,6 +91,17 @@ public: ...@@ -91,6 +91,17 @@ public:
for (; GetArgType() == arg_type; Next()) for (; GetArgType() == arg_type; Next())
f(*this); 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 */ } /* 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