diff options
Diffstat (limited to 'common/domainadaptor.h')
-rw-r--r-- | common/domainadaptor.h | 28 |
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 | */ |
41 | template <class Builder, class Buffer> | 41 | template <class Builder, class Buffer> |
42 | flatbuffers::Offset<Buffer> createBufferPart(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, const WritePropertyMapper<Builder> &mapper) | 42 | flatbuffers::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 | */ |
69 | template <typename Buffer, typename BufferBuilder> | 69 | template <typename Buffer, typename BufferBuilder> |
70 | static void createBufferPartBuffer(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, flatbuffers::FlatBufferBuilder &fbb, WritePropertyMapper<BufferBuilder> &mapper) | 70 | static 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 | */ |
86 | template <class LocalBuffer, class ResourceBuffer> | 86 | template <class LocalBuffer, class ResourceBuffer> |
87 | class GenericBufferAdaptor : public Akonadi2::ApplicationDomain::BufferAdaptor | 87 | class GenericBufferAdaptor : public Sink::ApplicationDomain::BufferAdaptor |
88 | { | 88 | { |
89 | public: | 89 | public: |
90 | GenericBufferAdaptor() | 90 | GenericBufferAdaptor() |
@@ -123,13 +123,13 @@ public: | |||
123 | template<typename DomainType, typename ResourceBuffer, typename ResourceBuilder> | 123 | template<typename DomainType, typename ResourceBuffer, typename ResourceBuilder> |
124 | class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface | 124 | class 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; |
128 | public: | 128 | public: |
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 | ||