Commit 6adf964c authored by Max Kellermann's avatar Max Kellermann

lib/dbus/ReadIter: add dbus_message_iter_get_fixed_array() wrapper

parent b59f37bc
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "Iter.hxx" #include "Iter.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"
#include "util/ConstBuffer.hxx"
#if GCC_OLDER_THAN(8,0) #if GCC_OLDER_THAN(8,0)
/* switch off completely bogus shadow warnings in older GCC /* switch off completely bogus shadow warnings in older GCC
...@@ -81,6 +82,14 @@ public: ...@@ -81,6 +82,14 @@ public:
return value; return value;
} }
template<typename T>
ConstBuffer<T> GetFixedArray() noexcept {
void *value;
int n_elements;
dbus_message_iter_get_fixed_array(&iter, &value, &n_elements);
return {(const T *)value, size_t(n_elements)};
}
/** /**
* Create a new iterator which recurses into a container * Create a new iterator which recurses into a container
* value. * value.
......
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