diff options
Diffstat (limited to 'common/query.h')
-rw-r--r-- | common/query.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/common/query.h b/common/query.h index 3362ac7..403c5b5 100644 --- a/common/query.h +++ b/common/query.h | |||
@@ -46,7 +46,8 @@ public: | |||
46 | enum Comparators { | 46 | enum Comparators { |
47 | Invalid, | 47 | Invalid, |
48 | Equals, | 48 | Equals, |
49 | Contains | 49 | Contains, |
50 | In | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | Comparator(); | 53 | Comparator(); |
@@ -158,6 +159,7 @@ public: | |||
158 | QByteArrayList requestedProperties; | 159 | QByteArrayList requestedProperties; |
159 | QByteArray parentProperty; | 160 | QByteArray parentProperty; |
160 | QByteArray sortProperty; | 161 | QByteArray sortProperty; |
162 | QByteArray type; | ||
161 | int limit; | 163 | int limit; |
162 | bool liveQuery; | 164 | bool liveQuery; |
163 | bool synchronousQuery; | 165 | bool synchronousQuery; |
@@ -222,6 +224,14 @@ public: | |||
222 | return filter(T::name, QVariant::fromValue(value.identifier())); | 224 | return filter(T::name, QVariant::fromValue(value.identifier())); |
223 | } | 225 | } |
224 | 226 | ||
227 | template <typename T> | ||
228 | Query &filter(const Query &query) | ||
229 | { | ||
230 | auto q = query; | ||
231 | q.type = ApplicationDomain::getTypeName<typename T::ReferenceType>(); | ||
232 | return filter(T::name, QVariant::fromValue(q)); | ||
233 | } | ||
234 | |||
225 | Query &filter(const ApplicationDomain::SinkResource &resource) | 235 | Query &filter(const ApplicationDomain::SinkResource &resource) |
226 | { | 236 | { |
227 | resources << resource.identifier(); | 237 | resources << resource.identifier(); |
@@ -353,3 +363,4 @@ public: | |||
353 | QDebug operator<<(QDebug dbg, const Sink::Query::Comparator &c); | 363 | QDebug operator<<(QDebug dbg, const Sink::Query::Comparator &c); |
354 | 364 | ||
355 | Q_DECLARE_OPERATORS_FOR_FLAGS(Sink::Query::Flags) | 365 | Q_DECLARE_OPERATORS_FOR_FLAGS(Sink::Query::Flags) |
366 | Q_DECLARE_METATYPE(Sink::Query); | ||