summaryrefslogtreecommitdiffstats
path: root/common/clientapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/clientapi.h')
-rw-r--r--common/clientapi.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/common/clientapi.h b/common/clientapi.h
index 37fb185..5182547 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -163,7 +163,7 @@ namespace async {
163namespace Akonadi2 { 163namespace Akonadi2 {
164 164
165/** 165/**
166 * Standardized Domain Types 166 * Standardized Application Domain Types
167 * 167 *
168 * They don't adhere to any standard and can be freely extended 168 * They don't adhere to any standard and can be freely extended
169 * Their sole purpose is providing a standardized interface to access data. 169 * Their sole purpose is providing a standardized interface to access data.
@@ -172,7 +172,7 @@ namespace Akonadi2 {
172 * 172 *
173 * These types will be frequently modified (for every new feature that should be exposed to the any client) 173 * These types will be frequently modified (for every new feature that should be exposed to the any client)
174 */ 174 */
175namespace Domain { 175namespace ApplicationDomain {
176 176
177/** 177/**
178 * This class has to be implemented by resources and can be used as generic interface to access the buffer properties 178 * This class has to be implemented by resources and can be used as generic interface to access the buffer properties
@@ -215,14 +215,14 @@ private:
215 * * provide a unified interface to read buffers (for zero-copy reading) 215 * * provide a unified interface to read buffers (for zero-copy reading)
216 * * record changes to generate changesets for modifications 216 * * record changes to generate changesets for modifications
217 */ 217 */
218class AkonadiDomainType { 218class ApplicationDomainType {
219public: 219public:
220 AkonadiDomainType() 220 ApplicationDomainType()
221 :mAdaptor(new MemoryBufferAdaptor()) 221 :mAdaptor(new MemoryBufferAdaptor())
222 { 222 {
223 223
224 } 224 }
225 AkonadiDomainType(const QByteArray &resourceName, const QByteArray &identifier, qint64 revision, const QSharedPointer<BufferAdaptor> &adaptor) 225 ApplicationDomainType(const QByteArray &resourceName, const QByteArray &identifier, qint64 revision, const QSharedPointer<BufferAdaptor> &adaptor)
226 : mAdaptor(adaptor), 226 : mAdaptor(adaptor),
227 mResourceName(resourceName), 227 mResourceName(resourceName),
228 mIdentifier(identifier), 228 mIdentifier(identifier),
@@ -230,7 +230,7 @@ public:
230 { 230 {
231 } 231 }
232 232
233 virtual ~AkonadiDomainType() {} 233 virtual ~ApplicationDomainType() {}
234 234
235 virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); } 235 virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); }
236 virtual void setProperty(const QByteArray &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } 236 virtual void setProperty(const QByteArray &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); }
@@ -246,25 +246,25 @@ private:
246 qint64 mRevision; 246 qint64 mRevision;
247}; 247};
248 248
249struct Event : public AkonadiDomainType { 249struct Event : public ApplicationDomainType {
250 typedef QSharedPointer<Event> Ptr; 250 typedef QSharedPointer<Event> Ptr;
251 using AkonadiDomainType::AkonadiDomainType; 251 using ApplicationDomainType::ApplicationDomainType;
252}; 252};
253 253
254struct Todo : public AkonadiDomainType { 254struct Todo : public ApplicationDomainType {
255 typedef QSharedPointer<Todo> Ptr; 255 typedef QSharedPointer<Todo> Ptr;
256 using AkonadiDomainType::AkonadiDomainType; 256 using ApplicationDomainType::ApplicationDomainType;
257}; 257};
258 258
259struct Calendar : public AkonadiDomainType { 259struct Calendar : public ApplicationDomainType {
260 typedef QSharedPointer<Calendar> Ptr; 260 typedef QSharedPointer<Calendar> Ptr;
261 using AkonadiDomainType::AkonadiDomainType; 261 using ApplicationDomainType::ApplicationDomainType;
262}; 262};
263 263
264class Mail : public AkonadiDomainType { 264class Mail : public ApplicationDomainType {
265}; 265};
266 266
267class Folder : public AkonadiDomainType { 267class Folder : public ApplicationDomainType {
268}; 268};
269 269
270/** 270/**
@@ -331,7 +331,7 @@ template<class DomainType>
331class StoreFacade { 331class StoreFacade {
332public: 332public:
333 virtual ~StoreFacade(){}; 333 virtual ~StoreFacade(){};
334 QByteArray type() const { return Domain::getTypeName<DomainType>(); } 334 QByteArray type() const { return ApplicationDomain::getTypeName<DomainType>(); }
335 virtual Async::Job<void> create(const DomainType &domainObject) = 0; 335 virtual Async::Job<void> create(const DomainType &domainObject) = 0;
336 virtual Async::Job<void> modify(const DomainType &domainObject) = 0; 336 virtual Async::Job<void> modify(const DomainType &domainObject) = 0;
337 virtual Async::Job<void> remove(const DomainType &domainObject) = 0; 337 virtual Async::Job<void> remove(const DomainType &domainObject) = 0;
@@ -362,7 +362,7 @@ public:
362 template<class DomainType, class Facade> 362 template<class DomainType, class Facade>
363 void registerFacade(const QByteArray &resource) 363 void registerFacade(const QByteArray &resource)
364 { 364 {
365 const QByteArray typeName = Domain::getTypeName<DomainType>(); 365 const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>();
366 mFacadeRegistry.insert(key(resource, typeName), [](){ return new Facade; }); 366 mFacadeRegistry.insert(key(resource, typeName), [](){ return new Facade; });
367 } 367 }
368 368
@@ -378,14 +378,14 @@ public:
378 template<class DomainType, class Facade> 378 template<class DomainType, class Facade>
379 void registerFacade(const QByteArray &resource, const std::function<void*(void)> &customFactoryFunction) 379 void registerFacade(const QByteArray &resource, const std::function<void*(void)> &customFactoryFunction)
380 { 380 {
381 const QByteArray typeName = Domain::getTypeName<DomainType>(); 381 const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>();
382 mFacadeRegistry.insert(key(resource, typeName), customFactoryFunction); 382 mFacadeRegistry.insert(key(resource, typeName), customFactoryFunction);
383 } 383 }
384 384
385 template<class DomainType> 385 template<class DomainType>
386 QSharedPointer<StoreFacade<DomainType> > getFacade(const QByteArray &resource) 386 QSharedPointer<StoreFacade<DomainType> > getFacade(const QByteArray &resource)
387 { 387 {
388 const QByteArray typeName = Domain::getTypeName<DomainType>(); 388 const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>();
389 auto factoryFunction = mFacadeRegistry.value(key(resource, typeName)); 389 auto factoryFunction = mFacadeRegistry.value(key(resource, typeName));
390 if (factoryFunction) { 390 if (factoryFunction) {
391 return QSharedPointer<StoreFacade<DomainType> >(static_cast<StoreFacade<DomainType>* >(factoryFunction())); 391 return QSharedPointer<StoreFacade<DomainType> >(static_cast<StoreFacade<DomainType>* >(factoryFunction()));