diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-20 13:34:38 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:50 +0200 |
commit | da0c37dbad121252effa85941de4d49222176179 (patch) | |
tree | 6ea9831e80fc18dcae00cdf2788680bb8f4d1935 /common/indexer.h | |
parent | 0dcc8e2985acbff52c497648e4fbb54e47bf3b51 (diff) | |
download | sink-da0c37dbad121252effa85941de4d49222176179.tar.gz sink-da0c37dbad121252effa85941de4d49222176179.zip |
A new indexer subsystem that can be used for indexes that are more
complex than a simple key-value pair.
Diffstat (limited to 'common/indexer.h')
-rw-r--r-- | common/indexer.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/common/indexer.h b/common/indexer.h new file mode 100644 index 0000000..7e148d1 --- /dev/null +++ b/common/indexer.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 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 "storage.h" | ||
22 | #include <QSharedPointer> | ||
23 | |||
24 | class TypeIndex; | ||
25 | namespace Sink { | ||
26 | namespace ApplicationDomain { | ||
27 | class ApplicationDomainType; | ||
28 | } | ||
29 | |||
30 | class Indexer | ||
31 | { | ||
32 | public: | ||
33 | typedef QSharedPointer<Indexer> Ptr; | ||
34 | virtual void add(const ApplicationDomain::ApplicationDomainType &entity) = 0; | ||
35 | virtual void modify(const ApplicationDomain::ApplicationDomainType &old, const ApplicationDomain::ApplicationDomainType &entity) = 0; | ||
36 | virtual void remove(const ApplicationDomain::ApplicationDomainType &entity) = 0; | ||
37 | |||
38 | protected: | ||
39 | Storage::DataStore::Transaction &transaction(); | ||
40 | TypeIndex &index(); | ||
41 | |||
42 | private: | ||
43 | friend class ::TypeIndex; | ||
44 | void setup(TypeIndex *, Storage::DataStore::Transaction *); | ||
45 | Storage::DataStore::Transaction *mTransaction; | ||
46 | TypeIndex *mTypeIndex; | ||
47 | }; | ||
48 | |||
49 | } | ||