From 4067462b0a27984df84b0379c19122d574253dfb Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 3 Jan 2015 00:08:44 +0100 Subject: Shared domain adaptors between resource and facade. --- dummyresource/facade.h | 50 ++------------------------------------------------ 1 file changed, 2 insertions(+), 48 deletions(-) (limited to 'dummyresource/facade.h') diff --git a/dummyresource/facade.h b/dummyresource/facade.h index 46b27ef..e01d254 100644 --- a/dummyresource/facade.h +++ b/dummyresource/facade.h @@ -21,62 +21,16 @@ #include "common/clientapi.h" #include "common/storage.h" +#include "resourcefactory.h" #include "entity_generated.h" #include "event_generated.h" #include "dummycalendar_generated.h" +#include "common/domainadaptor.h" namespace Akonadi2 { class ResourceAccess; } -/** - * The property mapper holds accessor functions for all properties. - * - * It is by default initialized with accessors that access the local-only buffer, - * and resource simply have to overwrite those accessors. - */ -template -class PropertyMapper -{ -public: - void setProperty(const QString &key, const QVariant &value, BufferType *buffer) - { - if (mWriteAccessors.contains(key)) { - auto accessor = mWriteAccessors.value(key); - return accessor(value, buffer); - } - } - - virtual QVariant getProperty(const QString &key, BufferType const *buffer) const - { - if (mReadAccessors.contains(key)) { - auto accessor = mReadAccessors.value(key); - return accessor(buffer); - } - return QVariant(); - } - QHash > mReadAccessors; - QHash > mWriteAccessors; -}; - -//The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. -//It defines how values are split accross local and resource buffer. -//This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way. -template -class DomainTypeAdaptorFactory -{ -}; - -template -class DomainTypeAdaptorFactory -{ -public: - QSharedPointer createAdaptor(const Akonadi2::Entity &entity); - -// private: - QSharedPointer > mLocalMapper; - QSharedPointer > mResourceMapper; -}; class DummyResourceFacade : public Akonadi2::StoreFacade { -- cgit v1.2.3