diff options
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r-- | common/pipeline.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp new file mode 100644 index 0000000..41def7c --- /dev/null +++ b/common/pipeline.cpp | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org> | ||
3 | * | ||
4 | * This library is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||
8 | * later version accepted by the membership of KDE e.V. (or its | ||
9 | * successor approved by the membership of KDE e.V.), which shall | ||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | #include "pipeline.h" | ||
22 | |||
23 | #include <QStandardPaths> | ||
24 | |||
25 | namespace Akonadi2 | ||
26 | { | ||
27 | |||
28 | class Pipeline::Private | ||
29 | { | ||
30 | public: | ||
31 | Private(const QString &storageName) | ||
32 | : storage(QStandardPaths::writableLocation(QStandardPaths::QStandardPaths::GenericDataLocation) + "/akonadi2", storageName, Akonadi2::Storage::ReadWrite) | ||
33 | { | ||
34 | |||
35 | } | ||
36 | |||
37 | Akonadi2::Storage storage; | ||
38 | }; | ||
39 | |||
40 | Pipeline::Pipeline(const QString &storageName) | ||
41 | : d(new Private(storageName)) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | Pipeline::~Pipeline() | ||
46 | { | ||
47 | } | ||
48 | |||
49 | Storage &Pipeline::storage() | ||
50 | { | ||
51 | return d->storage; | ||
52 | } | ||
53 | |||
54 | void Pipeline::null(uint messageId, const char *key, size_t keySize, const char *buffer, size_t bufferSize) | ||
55 | { | ||
56 | d->storage.write(key, keySize, buffer, bufferSize); | ||
57 | } | ||
58 | |||
59 | void Pipeline::newEntity(uint messageId, const char *key, size_t keySize, const char *buffer, size_t bufferSize) | ||
60 | { | ||
61 | d->storage.write(key, keySize, buffer, bufferSize); | ||
62 | } | ||
63 | |||
64 | void Pipeline::modifiedEntity(uint messageId, const char *key, size_t keySize, const char *buffer, size_t bufferSize) | ||
65 | { | ||
66 | d->storage.write(key, keySize, buffer, bufferSize); | ||
67 | } | ||
68 | |||
69 | void Pipeline::deletedEntity(uint messageId, const char *key, size_t keySize, const char *buffer, size_t bufferSize) | ||
70 | { | ||
71 | d->storage.write(key, keySize, buffer, bufferSize); | ||
72 | } | ||
73 | |||
74 | } // namespace Akonadi2 | ||
75 | |||