~unity-api-team/storage-framework/vivid

« back to all changes in this revision

Viewing changes to src/provider/internal/dbusmarshal.cpp

  • Committer: James Henstridge
  • Date: 2016-05-10 09:38:09 UTC
  • mto: (8.1.4 storage-framework)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james@jamesh.id.au-20160510093809-uywupy44te62qe91
Add demo script, and fix up bugs preventing method calls from being handled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include <unity/storage/provider/ProviderBase.h>
3
3
 
4
4
#include <cstdint>
 
5
#include <stdexcept>
5
6
 
6
7
using namespace std;
7
8
 
32
33
    return argument;
33
34
}
34
35
 
35
 
namespace internal
36
 
{
37
 
 
38
 
QVariant marshal_item(Item const& item)
39
 
{
40
 
    QDBusArgument argument;
41
 
    argument << item;
42
 
    return argument.asVariant();
 
36
QDBusArgument const& operator>>(QDBusArgument const& argument, Item& item)
 
37
{
 
38
    throw std::runtime_error("Item decode not implemented");
43
39
}
44
40
 
45
 
QVariant marshal_item_list(std::vector<Item> const& list)
 
41
QDBusArgument& operator<<(QDBusArgument& argument, std::vector<Item> const& items)
46
42
{
47
 
    QDBusArgument argument;
48
43
    argument.beginArray(qMetaTypeId<Item>());
49
 
    for (auto const& item : list)
 
44
    for (auto const& item : items)
50
45
    {
51
46
        argument << item;
52
47
    }
53
48
    argument.endArray();
54
 
    return argument.asVariant();
55
 
}
56
 
 
57
 
}
 
49
    return argument;
 
50
}
 
51
 
 
52
QDBusArgument const& operator>>(QDBusArgument const& argument, std::vector<Item>& items)
 
53
{
 
54
    throw std::runtime_error("std::vector<Item> decode not implemented");
 
55
}
 
56
 
58
57
}
59
58
}
60
59
}