diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-03 09:01:05 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-03 09:01:05 +0100 |
commit | 4d9746c828558c9f872e0aed52442863affb25d5 (patch) | |
tree | 507d7c2ba67f47d3cbbcf01a722236ff1b48426b /common/facadefactory.h | |
parent | 9cea920b7dd51867a0be0fed2f461b6be73c103e (diff) | |
download | sink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz sink-4d9746c828558c9f872e0aed52442863affb25d5.zip |
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'common/facadefactory.h')
-rw-r--r-- | common/facadefactory.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/common/facadefactory.h b/common/facadefactory.h index ef2a3f9..83b8898 100644 --- a/common/facadefactory.h +++ b/common/facadefactory.h | |||
@@ -38,7 +38,8 @@ namespace Sink { | |||
38 | * | 38 | * |
39 | * If we were to provide default implementations for certain capabilities. Here would be the place to do so. | 39 | * If we were to provide default implementations for certain capabilities. Here would be the place to do so. |
40 | */ | 40 | */ |
41 | class SINK_EXPORT FacadeFactory { | 41 | class SINK_EXPORT FacadeFactory |
42 | { | ||
42 | public: | 43 | public: |
43 | typedef std::function<std::shared_ptr<void>(const QByteArray &)> FactoryFunction; | 44 | typedef std::function<std::shared_ptr<void>(const QByteArray &)> FactoryFunction; |
44 | 45 | ||
@@ -48,10 +49,10 @@ public: | |||
48 | 49 | ||
49 | static QByteArray key(const QByteArray &resource, const QByteArray &type); | 50 | static QByteArray key(const QByteArray &resource, const QByteArray &type); |
50 | 51 | ||
51 | template<class DomainType, class Facade> | 52 | template <class DomainType, class Facade> |
52 | void registerFacade(const QByteArray &resource) | 53 | void registerFacade(const QByteArray &resource) |
53 | { | 54 | { |
54 | registerFacade(resource, [](const QByteArray &instanceIdentifier){ return std::make_shared<Facade>(instanceIdentifier); }, ApplicationDomain::getTypeName<DomainType>()); | 55 | registerFacade(resource, [](const QByteArray &instanceIdentifier) { return std::make_shared<Facade>(instanceIdentifier); }, ApplicationDomain::getTypeName<DomainType>()); |
55 | } | 56 | } |
56 | 57 | ||
57 | /* | 58 | /* |
@@ -59,7 +60,7 @@ public: | |||
59 | * | 60 | * |
60 | * Primarily for testing. | 61 | * Primarily for testing. |
61 | */ | 62 | */ |
62 | template<class DomainType, class Facade> | 63 | template <class DomainType, class Facade> |
63 | void registerFacade(const QByteArray &resource, const FactoryFunction &customFactoryFunction) | 64 | void registerFacade(const QByteArray &resource, const FactoryFunction &customFactoryFunction) |
64 | { | 65 | { |
65 | registerFacade(resource, customFactoryFunction, ApplicationDomain::getTypeName<DomainType>()); | 66 | registerFacade(resource, customFactoryFunction, ApplicationDomain::getTypeName<DomainType>()); |
@@ -72,11 +73,11 @@ public: | |||
72 | */ | 73 | */ |
73 | void resetFactory(); | 74 | void resetFactory(); |
74 | 75 | ||
75 | template<class DomainType> | 76 | template <class DomainType> |
76 | std::shared_ptr<StoreFacade<DomainType> > getFacade(const QByteArray &resource, const QByteArray &instanceIdentifier) | 77 | std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resource, const QByteArray &instanceIdentifier) |
77 | { | 78 | { |
78 | const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>(); | 79 | const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>(); |
79 | return std::static_pointer_cast<StoreFacade<DomainType> >(getFacade(resource, instanceIdentifier, typeName)); | 80 | return std::static_pointer_cast<StoreFacade<DomainType>>(getFacade(resource, instanceIdentifier, typeName)); |
80 | } | 81 | } |
81 | 82 | ||
82 | private: | 83 | private: |
@@ -87,6 +88,4 @@ private: | |||
87 | QHash<QByteArray, FactoryFunction> mFacadeRegistry; | 88 | QHash<QByteArray, FactoryFunction> mFacadeRegistry; |
88 | static QMutex sMutex; | 89 | static QMutex sMutex; |
89 | }; | 90 | }; |
90 | |||
91 | } | 91 | } |
92 | |||