diff options
author | Max Kellermann <max@musicpd.org> | 2019-02-20 22:34:34 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-02-21 12:56:05 +0100 |
commit | 6adf964c818dff459cfd8b812deaaa62823e6288 (patch) | |
tree | 97720947a1036733ed9fa75add2e5070116a8ce5 /src | |
parent | b59f37bc0a485113d0500c71bf179781f509e61f (diff) |
lib/dbus/ReadIter: add dbus_message_iter_get_fixed_array() wrapper
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/dbus/ReadIter.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/dbus/ReadIter.hxx b/src/lib/dbus/ReadIter.hxx index 9284f2baa..4d549a253 100644 --- a/src/lib/dbus/ReadIter.hxx +++ b/src/lib/dbus/ReadIter.hxx @@ -35,6 +35,7 @@ #include "Iter.hxx" #include "util/Compiler.h" +#include "util/ConstBuffer.hxx" #if GCC_OLDER_THAN(8,0) /* switch off completely bogus shadow warnings in older GCC @@ -81,6 +82,14 @@ public: 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 * value. |