diff options
-rw-r--r-- | common/domainadaptor.h | 12 | ||||
-rw-r--r-- | common/domaintypeadaptorfactoryinterface.h | 42 | ||||
-rw-r--r-- | common/facade.cpp | 1 | ||||
-rw-r--r-- | common/facade.h | 4 |
4 files changed, 48 insertions, 11 deletions
diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 620a658..b541e23 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm> | 2 | * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm> |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -23,6 +23,7 @@ | |||
23 | #include <QByteArray> | 23 | #include <QByteArray> |
24 | #include <functional> | 24 | #include <functional> |
25 | 25 | ||
26 | #include "domaintypeadaptorfactoryinterface.h" | ||
26 | #include "domain/applicationdomaintype.h" | 27 | #include "domain/applicationdomaintype.h" |
27 | #include "domain/event.h" | 28 | #include "domain/event.h" |
28 | #include "domain/mail.h" | 29 | #include "domain/mail.h" |
@@ -124,15 +125,6 @@ public: | |||
124 | QSharedPointer<ReadPropertyMapper<ResourceBuffer> > mResourceMapper; | 125 | QSharedPointer<ReadPropertyMapper<ResourceBuffer> > mResourceMapper; |
125 | }; | 126 | }; |
126 | 127 | ||
127 | class DomainTypeAdaptorFactoryInterface | ||
128 | { | ||
129 | public: | ||
130 | typedef QSharedPointer<DomainTypeAdaptorFactoryInterface> Ptr; | ||
131 | virtual ~DomainTypeAdaptorFactoryInterface() {}; | ||
132 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) = 0; | ||
133 | virtual void createBuffer(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainType, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = 0, size_t metadataSize = 0) = 0; | ||
134 | }; | ||
135 | |||
136 | /** | 128 | /** |
137 | * The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. | 129 | * The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. |
138 | * It defines how values are split accross local and resource buffer. | 130 | * It defines how values are split accross local and resource buffer. |
diff --git a/common/domaintypeadaptorfactoryinterface.h b/common/domaintypeadaptorfactoryinterface.h new file mode 100644 index 0000000..8c99aa1 --- /dev/null +++ b/common/domaintypeadaptorfactoryinterface.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | #pragma once | ||
20 | |||
21 | #include <QSharedPointer> | ||
22 | |||
23 | namespace Akonadi2 { | ||
24 | namespace ApplicationDomain { | ||
25 | class BufferAdaptor; | ||
26 | class ApplicationDomainType; | ||
27 | } | ||
28 | struct Entity; | ||
29 | } | ||
30 | |||
31 | namespace flatbuffers { | ||
32 | class FlatBufferBuilder; | ||
33 | } | ||
34 | |||
35 | class DomainTypeAdaptorFactoryInterface | ||
36 | { | ||
37 | public: | ||
38 | typedef QSharedPointer<DomainTypeAdaptorFactoryInterface> Ptr; | ||
39 | virtual ~DomainTypeAdaptorFactoryInterface() {}; | ||
40 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) = 0; | ||
41 | virtual void createBuffer(const Akonadi2::ApplicationDomain::ApplicationDomainType &domainType, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = 0, size_t metadataSize = 0) = 0; | ||
42 | }; | ||
diff --git a/common/facade.cpp b/common/facade.cpp index f534319..08f7500 100644 --- a/common/facade.cpp +++ b/common/facade.cpp | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "log.h" | 23 | #include "log.h" |
24 | #include "storage.h" | 24 | #include "storage.h" |
25 | #include "definitions.h" | 25 | #include "definitions.h" |
26 | #include "domainadaptor.h" | ||
26 | 27 | ||
27 | using namespace Akonadi2; | 28 | using namespace Akonadi2; |
28 | 29 | ||
diff --git a/common/facade.h b/common/facade.h index aa50941..794e35e 100644 --- a/common/facade.h +++ b/common/facade.h | |||
@@ -26,9 +26,11 @@ | |||
26 | 26 | ||
27 | #include "resourceaccess.h" | 27 | #include "resourceaccess.h" |
28 | #include "resultset.h" | 28 | #include "resultset.h" |
29 | #include "domainadaptor.h" | 29 | #include "domaintypeadaptorfactoryinterface.h" |
30 | #include "storage.h" | ||
30 | 31 | ||
31 | namespace Akonadi2 { | 32 | namespace Akonadi2 { |
33 | |||
32 | /** | 34 | /** |
33 | * Default facade implementation for resources that are implemented in a separate process using the ResourceAccess class. | 35 | * Default facade implementation for resources that are implemented in a separate process using the ResourceAccess class. |
34 | * | 36 | * |