-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MessageGet.cpp
52 lines (44 loc) · 1.12 KB
/
MessageGet.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "DBusUtils.hpp"
void UDBus::Message::setupContainer(UDBus::Iterator& it) noexcept
{
if (bInitialGet)
it.recurse();
else
{
auto& n = iteratorStack.emplace_back();
it.setGet(*this, &n, false);
}
bInitialGet = false;
}
void UDBus::Message::endContainer(const bool bWasInitial) noexcept
{
if (!bInitialGet)
iteratorStack.pop_back();
else if (bWasInitial)
bInitialGet = true;
}
UDBus::Variant& UDBus::makeVariant(UDBus::Variant&& v) noexcept
{
auto* tmp = new Variant{v};
return *tmp;
}
UDBus::IgnoreType& UDBus::ignore() noexcept
{
static IgnoreType i{};
return i;
}
UDBus::BumpType& UDBus::bump() noexcept
{
static BumpType i{};
return i;
}
UDBus::MessageGetResult UDBus::Message::handleVariants(UDBus::Iterator& current, const UDBus::Variant& data) noexcept
{
if (current.get_arg_type() != DBUS_TYPE_VARIANT)
return RESULT_INVALID_VARIANT_TYPE;
setupContainer(current);
if (!data.f(iteratorStack.back(), userPointer))
return RESULT_INVALID_VARIANT_PARSING;
endContainer(bInitialGet);
return RESULT_SUCCESS;
}