summaryrefslogtreecommitdiffstats
path: root/common/query.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-10 15:54:08 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-10 15:54:08 +0200
commit8296732635887e7b2ab738ba5da3154d8e3a06d3 (patch)
tree245ab263c862d19f7c8b4560f35c489773c85e9e /common/query.h
parent9e002cca99ad176fd9168123955cc0779a4e1237 (diff)
downloadsink-8296732635887e7b2ab738ba5da3154d8e3a06d3.tar.gz
sink-8296732635887e7b2ab738ba5da3154d8e3a06d3.zip
Some query API for use with property definitions
Diffstat (limited to 'common/query.h')
-rw-r--r--common/query.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/common/query.h b/common/query.h
index 8a420f9..8a7edf6 100644
--- a/common/query.h
+++ b/common/query.h
@@ -139,6 +139,40 @@ public:
139 return query; 139 return query;
140 } 140 }
141 141
142 template <typename T>
143 Query &request()
144 {
145 requestedProperties << T::name;
146 return *this;
147 }
148
149 template <typename T>
150 Query &sort()
151 {
152 sortProperty = T::name;
153 return *this;
154 }
155
156 template <typename T>
157 Query &filter(const QVariant &value)
158 {
159 propertyFilter.insert(T::name, value);
160 return *this;
161 }
162
163 template <typename T>
164 Query &filter(const ApplicationDomain::Entity &value)
165 {
166 propertyFilter.insert(T::name, QVariant::fromValue(value.identifier()));
167 return *this;
168 }
169
170 Query(const ApplicationDomain::Entity &value) : limit(0)
171 {
172 ids << value.identifier();
173 resources << value.resourceInstanceIdentifier();
174 }
175
142 Query(Flags flags = Flags()) : limit(0) 176 Query(Flags flags = Flags()) : limit(0)
143 { 177 {
144 } 178 }