refactor: improve type extensibility and its safety (#348)

This commit is contained in:
Stanislav Angelovič
2023-08-09 12:39:16 +02:00
committed by GitHub
parent 8728653359
commit 3e84b254e9
8 changed files with 18 additions and 13 deletions
+3 -4
View File
@@ -158,6 +158,9 @@ namespace sdbus {
Message& enterStruct(const std::string& signature);
Message& exitStruct();
Message& appendArray(char type, const void *ptr, size_t size);
Message& readArray(char type, const void **ptr, size_t *size);
explicit operator bool() const;
void clearFlags();
@@ -199,9 +202,6 @@ namespace sdbus {
template <typename _Element, typename _Allocator>
void deserializeArraySlow(std::vector<_Element, _Allocator>& items);
void appendArray(char type, const void *ptr, size_t size);
void readArray(char type, const void **ptr, size_t *size);
template <typename _Dictionary>
void serializeDictionary(const _Dictionary& items);
template <typename _Dictionary>
@@ -529,7 +529,6 @@ namespace sdbus {
while (true)
{
_Element elem;
// TODO: Is there a way to find D-Bus message container size upfront? We could reserve space in vector upfront.
if (*this >> elem)
items.emplace_back(std::move(elem));
else
+1 -1
View File
@@ -56,7 +56,7 @@ namespace sdbus {
Variant();
template <typename _ValueType>
Variant(const _ValueType& value)
explicit Variant(const _ValueType& value)
: Variant()
{
msg_.openVariant(signature_of<_ValueType>::str());