lib/dbus/Values: add uint32_t and uint64_t support

This commit is contained in:
Max Kellermann 2020-07-23 16:21:13 +02:00
parent 7376f31c97
commit 5e1a2e2a93
3 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,10 @@ public:
return AppendBasic(DBUS_TYPE_UINT32, &value); return AppendBasic(DBUS_TYPE_UINT32, &value);
} }
AppendMessageIter &Append(const uint64_t &value) {
return AppendBasic(DBUS_TYPE_UINT64, &value);
}
AppendMessageIter &AppendFixedArray(int element_type, AppendMessageIter &AppendFixedArray(int element_type,
const void *value, const void *value,
int n_elements) { int n_elements) {

View File

@ -62,6 +62,10 @@ template<>
struct TypeTraits<dbus_uint32_t> : BasicTypeTraits<DBUS_TYPE_UINT32> { struct TypeTraits<dbus_uint32_t> : BasicTypeTraits<DBUS_TYPE_UINT32> {
}; };
template<>
struct TypeTraits<dbus_uint64_t> : BasicTypeTraits<DBUS_TYPE_UINT64> {
};
using BooleanTypeTraits = BasicTypeTraits<DBUS_TYPE_BOOLEAN>; using BooleanTypeTraits = BasicTypeTraits<DBUS_TYPE_BOOLEAN>;
template<typename T> template<typename T>

View File

@ -64,6 +64,9 @@ struct Boolean {
:value(_value) {} :value(_value) {}
}; };
using Uint32 = BasicValue<dbus_uint32_t>;
using Uint64 = BasicValue<dbus_uint64_t>;
template<typename T, template<typename U> class WrapTraits> template<typename T, template<typename U> class WrapTraits>
struct WrapValue { struct WrapValue {
typedef typename T::Traits ContainedTraits; typedef typename T::Traits ContainedTraits;