diff options
Diffstat (limited to 'common/domain/folder.cpp')
-rw-r--r-- | common/domain/folder.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/common/domain/folder.cpp b/common/domain/folder.cpp new file mode 100644 index 0000000..50f73c2 --- /dev/null +++ b/common/domain/folder.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Christian Mollekopf <chrigi_1@fastfolder.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 | #include "folder.h" | ||
20 | |||
21 | #include <QVector> | ||
22 | #include <QByteArray> | ||
23 | #include <QString> | ||
24 | |||
25 | #include "../resultset.h" | ||
26 | #include "../index.h" | ||
27 | #include "../storage.h" | ||
28 | #include "../log.h" | ||
29 | #include "../propertymapper.h" | ||
30 | #include "../query.h" | ||
31 | #include "../definitions.h" | ||
32 | |||
33 | #include "folder_generated.h" | ||
34 | |||
35 | using namespace Akonadi2::ApplicationDomain; | ||
36 | |||
37 | ResultSet TypeImplementation<Folder>::queryIndexes(const Akonadi2::Query &query, const QByteArray &resourceInstanceIdentifier, QSet<QByteArray> &appliedFilters, Akonadi2::Storage::Transaction &transaction) | ||
38 | { | ||
39 | QVector<QByteArray> keys; | ||
40 | return ResultSet(keys); | ||
41 | } | ||
42 | |||
43 | void TypeImplementation<Folder>::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | void TypeImplementation<Folder>::removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | QSharedPointer<ReadPropertyMapper<TypeImplementation<Folder>::Buffer> > TypeImplementation<Folder>::initializeReadPropertyMapper() | ||
52 | { | ||
53 | auto propertyMapper = QSharedPointer<ReadPropertyMapper<Buffer> >::create(); | ||
54 | propertyMapper->addMapping<QString, Buffer>("parent", &Buffer::parent); | ||
55 | propertyMapper->addMapping<QString, Buffer>("name", &Buffer::name); | ||
56 | return propertyMapper; | ||
57 | } | ||
58 | |||
59 | QSharedPointer<WritePropertyMapper<TypeImplementation<Folder>::BufferBuilder> > TypeImplementation<Folder>::initializeWritePropertyMapper() | ||
60 | { | ||
61 | auto propertyMapper = QSharedPointer<WritePropertyMapper<BufferBuilder> >::create(); | ||
62 | propertyMapper->addMapping("parent", [](const QVariant &value, flatbuffers::FlatBufferBuilder &fbb) -> std::function<void(BufferBuilder &)> { | ||
63 | auto offset = variantToProperty<QString>(value, fbb); | ||
64 | return [offset](BufferBuilder &builder) { builder.add_parent(offset); }; | ||
65 | }); | ||
66 | propertyMapper->addMapping("name", [](const QVariant &value, flatbuffers::FlatBufferBuilder &fbb) -> std::function<void(BufferBuilder &)> { | ||
67 | auto offset = variantToProperty<QString>(value, fbb); | ||
68 | return [offset](BufferBuilder &builder) { builder.add_name(offset); }; | ||
69 | }); | ||
70 | return propertyMapper; | ||
71 | } | ||