summaryrefslogtreecommitdiffstats
path: root/common/domainadaptor.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/domainadaptor.h')
-rw-r--r--common/domainadaptor.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/common/domainadaptor.h b/common/domainadaptor.h
index 39bd3b8..d43fad7 100644
--- a/common/domainadaptor.h
+++ b/common/domainadaptor.h
@@ -39,7 +39,7 @@
39 * Create a buffer from a domain object using the provided mappings 39 * Create a buffer from a domain object using the provided mappings
40 */ 40 */
41template <class Builder, class Buffer> 41template <class Builder, class Buffer>
42flatbuffers::Offset<Buffer> createBufferPart(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, const WritePropertyMapper<Builder> &mapper) 42flatbuffers::Offset<Buffer> createBufferPart(const Sink::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, const WritePropertyMapper<Builder> &mapper)
43{ 43{
44 //First create a primitives such as strings using the mappings 44 //First create a primitives such as strings using the mappings
45 QList<std::function<void(Builder &)> > propertiesToAddToResource; 45 QList<std::function<void(Builder &)> > propertiesToAddToResource;
@@ -67,11 +67,11 @@ flatbuffers::Offset<Buffer> createBufferPart(const Akonadi2::ApplicationDomain::
67 * After this the buffer can be extracted from the FlatBufferBuilder object. 67 * After this the buffer can be extracted from the FlatBufferBuilder object.
68 */ 68 */
69template <typename Buffer, typename BufferBuilder> 69template <typename Buffer, typename BufferBuilder>
70static void createBufferPartBuffer(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, WritePropertyMapper<BufferBuilder> &mapper) 70static void createBufferPartBuffer(const Sink::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, WritePropertyMapper<BufferBuilder> &mapper)
71{ 71{
72 auto pos = createBufferPart<BufferBuilder, Buffer>(domainObject, fbb, mapper); 72 auto pos = createBufferPart<BufferBuilder, Buffer>(domainObject, fbb, mapper);
73 // Because we cannot template the following call 73 // Because we cannot template the following call
74 // Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(fbb, pos); 74 // Sink::ApplicationDomain::Buffer::FinishEventBuffer(fbb, pos);
75 // FIXME: This means all buffers in here must have the AKFB identifier 75 // FIXME: This means all buffers in here must have the AKFB identifier
76 fbb.Finish(pos, "AKFB"); 76 fbb.Finish(pos, "AKFB");
77 flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize()); 77 flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize());
@@ -84,7 +84,7 @@ static void createBufferPartBuffer(const Akonadi2::ApplicationDomain::Applicatio
84 * A generic adaptor implementation that uses a property mapper to read/write values. 84 * A generic adaptor implementation that uses a property mapper to read/write values.
85 */ 85 */
86template <class LocalBuffer, class ResourceBuffer> 86template <class LocalBuffer, class ResourceBuffer>
87class GenericBufferAdaptor : public Akonadi2::ApplicationDomain::BufferAdaptor 87class GenericBufferAdaptor : public Sink::ApplicationDomain::BufferAdaptor
88{ 88{
89public: 89public:
90 GenericBufferAdaptor() 90 GenericBufferAdaptor()
@@ -123,13 +123,13 @@ public:
123template<typename DomainType, typename ResourceBuffer, typename ResourceBuilder> 123template<typename DomainType, typename ResourceBuffer, typename ResourceBuilder>
124class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface 124class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface
125{ 125{
126 typedef typename Akonadi2::ApplicationDomain::TypeImplementation<DomainType>::Buffer LocalBuffer; 126 typedef typename Sink::ApplicationDomain::TypeImplementation<DomainType>::Buffer LocalBuffer;
127 typedef typename Akonadi2::ApplicationDomain::TypeImplementation<DomainType>::BufferBuilder LocalBuilder; 127 typedef typename Sink::ApplicationDomain::TypeImplementation<DomainType>::BufferBuilder LocalBuilder;
128public: 128public:
129 DomainTypeAdaptorFactory() : 129 DomainTypeAdaptorFactory() :
130 mLocalMapper(Akonadi2::ApplicationDomain::TypeImplementation<DomainType>::initializeReadPropertyMapper()), 130 mLocalMapper(Sink::ApplicationDomain::TypeImplementation<DomainType>::initializeReadPropertyMapper()),
131 mResourceMapper(QSharedPointer<ReadPropertyMapper<ResourceBuffer> >::create()), 131 mResourceMapper(QSharedPointer<ReadPropertyMapper<ResourceBuffer> >::create()),
132 mLocalWriteMapper(Akonadi2::ApplicationDomain::TypeImplementation<DomainType>::initializeWritePropertyMapper()), 132 mLocalWriteMapper(Sink::ApplicationDomain::TypeImplementation<DomainType>::initializeWritePropertyMapper()),
133 mResourceWriteMapper(QSharedPointer<WritePropertyMapper<ResourceBuilder> >::create()) 133 mResourceWriteMapper(QSharedPointer<WritePropertyMapper<ResourceBuilder> >::create())
134 {}; 134 {};
135 virtual ~DomainTypeAdaptorFactory() {}; 135 virtual ~DomainTypeAdaptorFactory() {};
@@ -139,11 +139,11 @@ public:
139 * 139 *
140 * This returns by default a GenericBufferAdaptor initialized with the corresponding property mappers. 140 * This returns by default a GenericBufferAdaptor initialized with the corresponding property mappers.
141 */ 141 */
142 virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) Q_DECL_OVERRIDE 142 virtual QSharedPointer<Sink::ApplicationDomain::BufferAdaptor> createAdaptor(const Sink::Entity &entity) Q_DECL_OVERRIDE
143 { 143 {
144 const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<ResourceBuffer>(entity.resource()); 144 const auto resourceBuffer = Sink::EntityBuffer::readBuffer<ResourceBuffer>(entity.resource());
145 const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<LocalBuffer>(entity.local()); 145 const auto localBuffer = Sink::EntityBuffer::readBuffer<LocalBuffer>(entity.local());
146 // const auto metadataBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Metadata>(entity.metadata()); 146 // const auto metadataBuffer = Sink::EntityBuffer::readBuffer<Sink::Metadata>(entity.metadata());
147 147
148 auto adaptor = QSharedPointer<GenericBufferAdaptor<LocalBuffer, ResourceBuffer> >::create(); 148 auto adaptor = QSharedPointer<GenericBufferAdaptor<LocalBuffer, ResourceBuffer> >::create();
149 adaptor->mLocalBuffer = localBuffer; 149 adaptor->mLocalBuffer = localBuffer;
@@ -153,7 +153,7 @@ public:
153 return adaptor; 153 return adaptor;
154 } 154 }
155 155
156 virtual void createBuffer(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = 0, size_t metadataSize = 0) Q_DECL_OVERRIDE 156 virtual void createBuffer(const Sink::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = 0, size_t metadataSize = 0) Q_DECL_OVERRIDE
157 { 157 {
158 flatbuffers::FlatBufferBuilder localFbb; 158 flatbuffers::FlatBufferBuilder localFbb;
159 if (mLocalWriteMapper) { 159 if (mLocalWriteMapper) {
@@ -167,7 +167,7 @@ public:
167 createBufferPartBuffer<ResourceBuffer, ResourceBuilder>(domainObject, resFbb, *mResourceWriteMapper); 167 createBufferPartBuffer<ResourceBuffer, ResourceBuilder>(domainObject, resFbb, *mResourceWriteMapper);
168 } 168 }
169 169
170 Akonadi2::EntityBuffer::assembleEntityBuffer(fbb, metadataData, metadataSize, resFbb.GetBufferPointer(), resFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); 170 Sink::EntityBuffer::assembleEntityBuffer(fbb, metadataData, metadataSize, resFbb.GetBufferPointer(), resFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize());
171 } 171 }
172 172
173 173