diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-13 01:27:21 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-13 01:27:21 +0200 |
commit | b6d5d206de4d02149c6530236154283bf834087a (patch) | |
tree | 0d57764b674df3ffee1df3f3e9fb1690ae06bbdc /common/query.h | |
parent | 7c9ae062101b5dc8f963c70fb753f8346a9b5c48 (diff) | |
download | sink-b6d5d206de4d02149c6530236154283bf834087a.tar.gz sink-b6d5d206de4d02149c6530236154283bf834087a.zip |
Untangled the include dependencies a bit.
We no longer depend on clientapi.h from everywhere.
Diffstat (limited to 'common/query.h')
-rw-r--r-- | common/query.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/common/query.h b/common/query.h new file mode 100644 index 0000000..0cad9fb --- /dev/null +++ b/common/query.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm> | ||
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 | #pragma once | ||
21 | |||
22 | #include <QByteArrayList> | ||
23 | #include <QHash> | ||
24 | #include <QSet> | ||
25 | |||
26 | namespace Akonadi2 { | ||
27 | |||
28 | /** | ||
29 | * A query that matches a set of objects | ||
30 | * | ||
31 | * The query will have to be updated regularly similary to the domain objects. | ||
32 | * It probably also makes sense to have a domain specific part of the query, | ||
33 | * such as what properties we're interested in (necessary information for on-demand | ||
34 | * loading of data). | ||
35 | * | ||
36 | * The query defines: | ||
37 | * * what resources to search | ||
38 | * * filters on various properties (parent collection, startDate range, ....) | ||
39 | * * properties we need (for on-demand querying) | ||
40 | * | ||
41 | * syncOnDemand: Execute a source sync before executing the query | ||
42 | * processAll: Ensure all local messages are processed before querying to guarantee an up-to date dataset. | ||
43 | */ | ||
44 | class Query | ||
45 | { | ||
46 | public: | ||
47 | Query() : syncOnDemand(true), processAll(false), liveQuery(false) {} | ||
48 | //Could also be a propertyFilter | ||
49 | QByteArrayList resources; | ||
50 | //Could also be a propertyFilter | ||
51 | QByteArrayList ids; | ||
52 | //Filters to apply | ||
53 | QHash<QByteArray, QVariant> propertyFilter; | ||
54 | //Properties to retrieve | ||
55 | QSet<QByteArray> requestedProperties; | ||
56 | bool syncOnDemand; | ||
57 | bool processAll; | ||
58 | //If live query is false, this query will not continuously be updated | ||
59 | bool liveQuery; | ||
60 | }; | ||
61 | |||
62 | } | ||