diff options
Diffstat (limited to 'common/domainadaptor.cpp')
-rw-r--r-- | common/domainadaptor.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/domainadaptor.cpp b/common/domainadaptor.cpp index 5e6f062..aa8c3d9 100644 --- a/common/domainadaptor.cpp +++ b/common/domainadaptor.cpp | |||
@@ -20,6 +20,15 @@ | |||
20 | #include "domainadaptor.h" | 20 | #include "domainadaptor.h" |
21 | 21 | ||
22 | template <> | 22 | template <> |
23 | flatbuffers::uoffset_t extractProperty<QString>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) | ||
24 | { | ||
25 | if (property.isValid()) { | ||
26 | return fbb.CreateString(property.toString().toStdString()).o; | ||
27 | } | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | template <> | ||
23 | QSharedPointer<ReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > initializeReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event>() | 32 | QSharedPointer<ReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > initializeReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event>() |
24 | { | 33 | { |
25 | auto propertyMapper = QSharedPointer<ReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> >::create(); | 34 | auto propertyMapper = QSharedPointer<ReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> >::create(); |
@@ -38,3 +47,17 @@ QSharedPointer<ReadPropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > | |||
38 | return propertyMapper; | 47 | return propertyMapper; |
39 | } | 48 | } |
40 | 49 | ||
50 | template <> | ||
51 | QSharedPointer<WritePropertyMapper<Akonadi2::ApplicationDomain::Buffer::EventBuilder> > initializeWritePropertyMapper<Akonadi2::ApplicationDomain::Buffer::EventBuilder>() | ||
52 | { | ||
53 | auto propertyMapper = QSharedPointer<WritePropertyMapper<Akonadi2::ApplicationDomain::Buffer::EventBuilder> >::create(); | ||
54 | propertyMapper->addMapping("summary", [](const QVariant &value, flatbuffers::FlatBufferBuilder &fbb) -> std::function<void(Akonadi2::ApplicationDomain::Buffer::EventBuilder &)> { | ||
55 | auto offset = extractProperty<QString>(value, fbb); | ||
56 | return [offset](Akonadi2::ApplicationDomain::Buffer::EventBuilder &builder) { builder.add_summary(offset); }; | ||
57 | }); | ||
58 | propertyMapper->addMapping("uid", [](const QVariant &value, flatbuffers::FlatBufferBuilder &fbb) -> std::function<void(Akonadi2::ApplicationDomain::Buffer::EventBuilder &)> { | ||
59 | auto offset = extractProperty<QString>(value, fbb); | ||
60 | return [offset](Akonadi2::ApplicationDomain::Buffer::EventBuilder &builder) { builder.add_uid(offset); }; | ||
61 | }); | ||
62 | return propertyMapper; | ||
63 | } | ||