summaryrefslogtreecommitdiffstats
path: root/common/facade.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
commit4d9746c828558c9f872e0aed52442863affb25d5 (patch)
tree507d7c2ba67f47d3cbbcf01a722236ff1b48426b /common/facade.cpp
parent9cea920b7dd51867a0be0fed2f461b6be73c103e (diff)
downloadsink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz
sink-4d9746c828558c9f872e0aed52442863affb25d5.zip
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'common/facade.cpp')
-rw-r--r--common/facade.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/common/facade.cpp b/common/facade.cpp
index 1219887..803f85c 100644
--- a/common/facade.cpp
+++ b/common/facade.cpp
@@ -32,31 +32,29 @@ using namespace Sink;
32#undef DEBUG_AREA 32#undef DEBUG_AREA
33#define DEBUG_AREA "client.facade" 33#define DEBUG_AREA "client.facade"
34 34
35template<class DomainType> 35template <class DomainType>
36GenericFacade<DomainType>::GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory , const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess) 36GenericFacade<DomainType>::GenericFacade(
37 : Sink::StoreFacade<DomainType>(), 37 const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory, const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess)
38 mResourceAccess(resourceAccess), 38 : Sink::StoreFacade<DomainType>(), mResourceAccess(resourceAccess), mDomainTypeAdaptorFactory(adaptorFactory), mResourceInstanceIdentifier(resourceIdentifier)
39 mDomainTypeAdaptorFactory(adaptorFactory),
40 mResourceInstanceIdentifier(resourceIdentifier)
41{ 39{
42 if (!mResourceAccess) { 40 if (!mResourceAccess) {
43 mResourceAccess = ResourceAccessFactory::instance().getAccess(resourceIdentifier); 41 mResourceAccess = ResourceAccessFactory::instance().getAccess(resourceIdentifier);
44 } 42 }
45} 43}
46 44
47template<class DomainType> 45template <class DomainType>
48GenericFacade<DomainType>::~GenericFacade() 46GenericFacade<DomainType>::~GenericFacade()
49{ 47{
50} 48}
51 49
52template<class DomainType> 50template <class DomainType>
53QByteArray GenericFacade<DomainType>::bufferTypeForDomainType() 51QByteArray GenericFacade<DomainType>::bufferTypeForDomainType()
54{ 52{
55 //We happen to have a one to one mapping 53 // We happen to have a one to one mapping
56 return Sink::ApplicationDomain::getTypeName<DomainType>(); 54 return Sink::ApplicationDomain::getTypeName<DomainType>();
57} 55}
58 56
59template<class DomainType> 57template <class DomainType>
60KAsync::Job<void> GenericFacade<DomainType>::create(const DomainType &domainObject) 58KAsync::Job<void> GenericFacade<DomainType>::create(const DomainType &domainObject)
61{ 59{
62 if (!mDomainTypeAdaptorFactory) { 60 if (!mDomainTypeAdaptorFactory) {
@@ -68,7 +66,7 @@ KAsync::Job<void> GenericFacade<DomainType>::create(const DomainType &domainObje
68 return mResourceAccess->sendCreateCommand(bufferTypeForDomainType(), BufferUtils::extractBuffer(entityFbb)); 66 return mResourceAccess->sendCreateCommand(bufferTypeForDomainType(), BufferUtils::extractBuffer(entityFbb));
69} 67}
70 68
71template<class DomainType> 69template <class DomainType>
72KAsync::Job<void> GenericFacade<DomainType>::modify(const DomainType &domainObject) 70KAsync::Job<void> GenericFacade<DomainType>::modify(const DomainType &domainObject)
73{ 71{
74 if (!mDomainTypeAdaptorFactory) { 72 if (!mDomainTypeAdaptorFactory) {
@@ -80,16 +78,16 @@ KAsync::Job<void> GenericFacade<DomainType>::modify(const DomainType &domainObje
80 return mResourceAccess->sendModifyCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType(), QByteArrayList(), BufferUtils::extractBuffer(entityFbb)); 78 return mResourceAccess->sendModifyCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType(), QByteArrayList(), BufferUtils::extractBuffer(entityFbb));
81} 79}
82 80
83template<class DomainType> 81template <class DomainType>
84KAsync::Job<void> GenericFacade<DomainType>::remove(const DomainType &domainObject) 82KAsync::Job<void> GenericFacade<DomainType>::remove(const DomainType &domainObject)
85{ 83{
86 return mResourceAccess->sendDeleteCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType()); 84 return mResourceAccess->sendDeleteCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType());
87} 85}
88 86
89template<class DomainType> 87template <class DomainType>
90QPair<KAsync::Job<void>, typename ResultEmitter<typename DomainType::Ptr>::Ptr> GenericFacade<DomainType>::load(const Sink::Query &query) 88QPair<KAsync::Job<void>, typename ResultEmitter<typename DomainType::Ptr>::Ptr> GenericFacade<DomainType>::load(const Sink::Query &query)
91{ 89{
92 //The runner lives for the lifetime of the query 90 // The runner lives for the lifetime of the query
93 auto runner = new QueryRunner<DomainType>(query, mResourceAccess, mResourceInstanceIdentifier, mDomainTypeAdaptorFactory, bufferTypeForDomainType()); 91 auto runner = new QueryRunner<DomainType>(query, mResourceAccess, mResourceInstanceIdentifier, mDomainTypeAdaptorFactory, bufferTypeForDomainType());
94 runner->setResultTransformation(mResultTransformation); 92 runner->setResultTransformation(mResultTransformation);
95 return qMakePair(KAsync::null<void>(), runner->emitter()); 93 return qMakePair(KAsync::null<void>(), runner->emitter());