diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-15 01:56:09 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-15 01:56:09 +0100 |
commit | bc2a95cad05e454a84c317f1078edb329bd3afd4 (patch) | |
tree | 4cb54032b075a8730a532ccd7485db598e859ac8 /dummyresource/facade.cpp | |
parent | 70bb707903da21103b84e0f3effcaa0a24612d5c (diff) | |
download | sink-bc2a95cad05e454a84c317f1078edb329bd3afd4.tar.gz sink-bc2a95cad05e454a84c317f1078edb329bd3afd4.zip |
Writing from facade.
Diffstat (limited to 'dummyresource/facade.cpp')
-rw-r--r-- | dummyresource/facade.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index f754c7e..668fbbf 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "event_generated.h" | 28 | #include "event_generated.h" |
29 | #include "entity_generated.h" | 29 | #include "entity_generated.h" |
30 | #include "metadata_generated.h" | 30 | #include "metadata_generated.h" |
31 | #include "createentity_generated.h" | ||
31 | #include "domainadaptor.h" | 32 | #include "domainadaptor.h" |
32 | #include <common/entitybuffer.h> | 33 | #include <common/entitybuffer.h> |
33 | 34 | ||
@@ -48,6 +49,29 @@ DummyResourceFacade::~DummyResourceFacade() | |||
48 | void DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) | 49 | void DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) |
49 | { | 50 | { |
50 | //Create message buffer and send to resource | 51 | //Create message buffer and send to resource |
52 | flatbuffers::FlatBufferBuilder eventFbb; | ||
53 | eventFbb.Clear(); | ||
54 | { | ||
55 | auto summary = eventFbb.CreateString("summary"); | ||
56 | // auto data = fbb.CreateUninitializedVector<uint8_t>(attachmentSize); | ||
57 | DummyCalendar::DummyEventBuilder eventBuilder(eventFbb); | ||
58 | eventBuilder.add_summary(summary); | ||
59 | auto eventLocation = eventBuilder.Finish(); | ||
60 | DummyCalendar::FinishDummyEventBuffer(eventFbb, eventLocation); | ||
61 | // memcpy((void*)DummyCalendar::GetDummyEvent(fbb.GetBufferPointer())->attachment()->Data(), rawData, attachmentSize); | ||
62 | } | ||
63 | flatbuffers::FlatBufferBuilder entityFbb; | ||
64 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), 0, 0); | ||
65 | |||
66 | flatbuffers::FlatBufferBuilder fbb; | ||
67 | auto type = fbb.CreateString(Akonadi2::Domain::getTypeName<Akonadi2::Domain::Event>().toStdString().data()); | ||
68 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | ||
69 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | ||
70 | builder.add_domainType(type); | ||
71 | builder.add_delta(delta); | ||
72 | auto location = builder.Finish(); | ||
73 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | ||
74 | mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); | ||
51 | } | 75 | } |
52 | 76 | ||
53 | void DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) | 77 | void DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) |