diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-16 22:19:43 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-16 22:19:43 +0200 |
commit | 749c4d7da40bf20d240be5ad7948f4be843865cd (patch) | |
tree | 038e54650450f532c2eaafa68a6a3d606928ff8f /common/facade.h | |
parent | 3ae86373f2238bcd771392f329b52d7b8923d003 (diff) | |
download | sink-749c4d7da40bf20d240be5ad7948f4be843865cd.tar.gz sink-749c4d7da40bf20d240be5ad7948f4be843865cd.zip |
Simpler facade and domaintypeadaptorfactory instantiation
Diffstat (limited to 'common/facade.h')
-rw-r--r-- | common/facade.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/facade.h b/common/facade.h index a24ac7a..658ccb8 100644 --- a/common/facade.h +++ b/common/facade.h | |||
@@ -55,7 +55,7 @@ public: | |||
55 | */ | 55 | */ |
56 | GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory = DomainTypeAdaptorFactoryInterface::Ptr(), | 56 | GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory = DomainTypeAdaptorFactoryInterface::Ptr(), |
57 | const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess = QSharedPointer<Sink::ResourceAccessInterface>()); | 57 | const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess = QSharedPointer<Sink::ResourceAccessInterface>()); |
58 | ~GenericFacade(); | 58 | virtual ~GenericFacade(); |
59 | 59 | ||
60 | static QByteArray bufferTypeForDomainType(); | 60 | static QByteArray bufferTypeForDomainType(); |
61 | KAsync::Job<void> create(const DomainType &domainObject) Q_DECL_OVERRIDE; | 61 | KAsync::Job<void> create(const DomainType &domainObject) Q_DECL_OVERRIDE; |
@@ -70,4 +70,16 @@ protected: | |||
70 | DomainTypeAdaptorFactoryInterface::Ptr mDomainTypeAdaptorFactory; | 70 | DomainTypeAdaptorFactoryInterface::Ptr mDomainTypeAdaptorFactory; |
71 | QByteArray mResourceInstanceIdentifier; | 71 | QByteArray mResourceInstanceIdentifier; |
72 | }; | 72 | }; |
73 | |||
74 | /** | ||
75 | * A default facade implemenation that simply instantiates a generic resource with the given DomainTypeAdaptorFactory | ||
76 | */ | ||
77 | template<typename DomainType, typename DomainTypeAdaptorFactory> | ||
78 | class DefaultFacade : public GenericFacade<DomainType> | ||
79 | { | ||
80 | public: | ||
81 | DefaultFacade(const QByteArray &resourceIdentifier) : GenericFacade<DomainType>(resourceIdentifier, QSharedPointer<DomainTypeAdaptorFactory>::create()) {} | ||
82 | virtual ~DefaultFacade(){} | ||
83 | }; | ||
84 | |||
73 | } | 85 | } |